Hi, thanks for reading.
Anyone know how to use this command in a "execute command" stage within a sequencer. Want to get the command to work then replace -print with delete so I can delete all empty files.
cd /directory_name|find . ! -size 0 -print
tried using 'cd' as the command and '/DStage_workfiles/iiwdev/Rejects|find . ! -size 0 -print' as the parameters. But it printed files from a different directory. Not results I expected. Any help is greatly appreciated.
here is the output
SeqRich_ErrFilesTest..JobControl (@cmdRemoveTriggerFile): Executed: cd /DStage_workfiles/iiwdev/Rejects|find . ! -size 0 -print
Reply=0
Output from command ====>
.
./&COMO&
./&COMO&/INSTALL
./&COMO&/PROJECT.UPGRAD
./&COMO&/PROJECT.UPGRAD/E
./&COMO&/SETUP.EXAMPLE1
./&COMO&/SETUP.EXAMPLE1/?
./&PH&
./&PH&/DSD.RUN_25405_15914_065632
./&PH&/DSD.RUN_26738_15927_242087
./&PH&/DSD.RUN_27493_15732_713615
./&PH&/DSD.RUN_28558_16020_018112
./&PH&/DSD.RUN_28773_15613_730682
./&PH&/DSD.RUN_28792_15591_553238
./&PH&/DSD.RUN_28807_15591_39
etc.....
"Execute Command" stage in sequencer
Moderators: chulett, rschirm, roy
Re: "Execute Command" stage in sequencer
Why do you want to change the directory and then execute the command?
Try to use it as a single command like below.
find FILEPATH ! -size 0 -print
DS User
Try to use it as a single command like below.
find FILEPATH ! -size 0 -print
DS User
A command Sequencer's default directory is your project directory. Should the CD fail, you will be in your project directory.
trust me... you do NOT want to blindly delete files assuming the CD worked.
Write a script, test the return code of the CD, or better yet, fully qualify the path of the files you wish to delete.
I have seen to many users write bad code like that and nuke their project directory.
trust me... you do NOT want to blindly delete files assuming the CD worked.
Write a script, test the return code of the CD, or better yet, fully qualify the path of the files you wish to delete.
I have seen to many users write bad code like that and nuke their project directory.
SURA's solution should be what you are actually looking for, following what you were doing, the correct way is to cd path && find . (etc)... this will mean the find is only executed if the cd was successful. what you were doing is piping the result of the cd to the find, which doesn't really mean much
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You have marked this resolved, but you risk causing unintended, perhaps serious problems, as PaulVL described.Marley777 wrote:This worked for me
find FILEPATH ! -size 0 -print
I suggest you study the find command in detail before deleting.
As is, it will recursively search through all subdirectories beneath FILEPATH and identify all NON-empty files according to the -size 0 option you've used--it's not based on the file's actual byte size but rather the file's block size (file size rounded up to nearest block size).
Read the man page about the find command's option to determine the correct option.
Choose a job you love, and you will never have to work a day in your life. - Confucius