Here I am giving a simple bash shell script to move all the empty files (zero byte) from current directory to another location-
1. Go to that path where you want to move the files from.
2. Make a text file and edit the following lines (accordingly) -
#!/bin/bash
for i in `ls`
do
if [ -s $i ]
then
echo "The file $i has data"
else
mv $i <Path where you want to move the empty files>
fi
done
3. Save the file, give execute permission (chmod +x filename) and run.
Hope you've got the desired result.. : )
No comments:
Post a Comment