-s tells you the file exists and is greater than zero length.
one of many ways to do this - some versions of test (what [[ means to the shell )
do not have -z, I know one of mine does not. Oh - make sure sample.txt is zero bytes long, too.
try reading the manpage for test for your system.
Hi,
I would like to write a shell script that moves files from one folder to another without retrieving the error 'can not find file or folder' when the folder is empty.
Any ideas,
Thx in advance,
Steven. (8 Replies)
as of our requiremnt some x no of files will be created from a third party tool ,out of them one or two files will be empty i.e size is 0. so i want to remove those files which are empty.
naming of the files which are created will be like this
abc_.txt 0 size
abc_1.txt 4000 size
abc_2.txt... (1 Reply)
Is there any way, we can find files not empty? I know one can find empty files by using find with -size is equalled to 0.
Please let me know, how I can find files greater than 0 or any other size in number? (2 Replies)
Hello Gurus,
I want to delete only empty files (files with 0 bytes) at once from the local directory. Rightnow I need to go through all the files one by one manually and check the empty files before deleting them. Is there any unix command that finds and deletes empty files in a directory?... (5 Replies)
Hi all,
Can you tell me how to empty all files in a directory with a "find" command?
It does not seem to work the way I try it:
# ls -l *.dat
-rw-r--r-- 1 root root 7 Jul 20 20:51 la2.dat
-rw-r--r-- 1 root root 4 Jul 20 20:51 la.dat
# find... (9 Replies)
The following files were wiped out - new empty files were left in their place.
/etc/inittab, /etc/inetd.conf, and /etc/MANPATH
The system is running HP-UX 11i v3 - Mar08.
Anyone seen anything like this?
Any ideas on a way to figure this out if it happens again or a suggested way to... (9 Replies)
Use and complete the template provided. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a single command to create a new empty file in P1 called cloud9, I have to do it from my current working directory which is P3 cd ../ away
P1... (1 Reply)
Hi everyone, I am new to shell scripting.Please help.
I have list of files under some path /opt/thomas/
FileNames : 1.txt,2.txt,3.txt
I would like to check if these three files exists and not empty,continue with the script or else write error message file not found or file empty
Thanks (2 Replies)