Hello,
I have file all_file.txt
at the end of process this file all_file.txt should be deleted only if there is no file present in dir /all_file/tmp/ or in it's sub directory.
can you please help me with the peace of code for this.
Thanks
Hello,
I have file all_file.txt
at the end of process this file all_file.txt should be deleted only if there is no file present in dir /all_file/tmp/ or in it's sub directory.
can you please help me with the peace of code for this.
Thanks
if [ `find /all_file/tmp -type f|line`"X" = "X" ]
then
rm all_file.txt
fi
The 'find' will find all files, 'line' just lets one file name through (for speed and stability), but if there is a first file, its name will be concatenated to "X" and the compare fails.
what if i want to ignore particular extension say .log is there any way
now i am using your below code.
#!/usr/bin/ksh
if [ `find /all_file/tmp -type f -prune -name "*.txt" |line`"X" = "X" ]
then
rm all_file.txt
fi
but if there is a first file, its name will be concatenated to "X" and the compare fails. - Can you explain this more.
Thanks