Maybe you need the "-d" switch to "ls" to make "ls" show the directory not its contents. For consistency the "-d" also works with files.
Obviously be aware that "rm" on a file changes the "last modified" time on the directory which holds that file.
I'm trying to figure out a way to delete empty files in a directory. I have a cron that runs and creates a flat file every 15 mins. However, most times at night the flat file will be empty.
I'd like to run a script to delete empty files that end with *.dat
Any suggestions?
Rich (1 Reply)
Hi,
I have dummies questions:
My script here can find the files in any directories older than 30 days then it will delete the files but not the directories. I would like to also be able to delete the directories that hold old files more than 30 days not just the files itself.
find . -type f... (2 Replies)
Hello Friends,
Im trying to delete empty files in subdirectories with a command. I can find them checking only one directory in each step and then show them with my command like below moreover i could not add removing part:
ls -l */* | awk '{if ($5==0) printf "%3s %2d %s... (5 Replies)
Hello, I'm submitting this thread, because I was looking a way to delete empty directories using find and I found a thread from 2007 that helped me. I have worked from that threat, but I found that the command sent would analyze original directory and may delete it to. I have come up with expanded... (3 Replies)
Hello
I have some directories and files created under /export/local/user
I would like to delete directories only under /export/local/user, created before 3 days
Can someone help me with command to do this task?
Thanks (4 Replies)
I'm trying to write a shell script to files of zero length in a specified directory, but I keep getting errors. Would anybody be kind enough to look it over for issues? Thanks a bunch in advance.
#!/bin/sh
if
then
if
then
find $1 -type f -size 0 -print|xargs rm
exit 0... (1 Reply)
Hi,
I want to delete all empty directories in a long directore tree structure. I want to use that from a script that will run on HP-UX 11. My definition of empty directory is that there is no regular file under it and directly beneath it. To elaborate, I have below directories.
/app/dev/java... (14 Replies)
My code to "Delete empty files from a directory entered in command promt"
#/bin/sh
echo "Enter directory"
read gh
for file in `ls $gh`
do
# to get the size of file
a=$( ls -l file | awk ' {print $7} ');
echo $a
if
then
echo "removing file "
rm file
fi
done (6 Replies)
I have a task, I usually do manually, but with growing responsibilities I tend to forget to do this weekly, I want to write a script that automates this, but I cant seem to work it out in my head, I have the shell of it out, but need help, and you guys have helped me with EVERY problem I have... (5 Replies)
Hi,
I need help in regard to developing a shell script to delete empty files from multiple specific locations. The directory paths will be stored in a text file. So the requirement is to read the text file for one specific path and then remove empty files from that particular path. Looping through... (4 Replies)
Discussion started by: Khan28
4 Replies
LEARN ABOUT DEBIAN
smd-push
smd-push(1) Sync Mail Dir (smd) documentation smd-push(1)NAME
smd-push - syncs the remote mail dir letting the local one untouched
SYNOPSIS
smd-push [-d|--dry-run] [-v|--verbose] [-s|--show-tags] [-t|--template-only]
[-n|--no-delete] [endpoint]
DESCRIPTION
smd-push performs in the remote maildir all the changes that were performed on the local one.
No changes are made on the local maildir. Use smd-pull(1) for that.
Refer to smd-config(5) for the configuration file format.
OPTIONS -v --verbose
Verbose output
-s --show-tags
Machine readable output
-d --dry-run
Do not perform any action for real
-n --no-delete
Do not propagate deletions
-t --template-only
Just create a template configuration file if none
endpoint
Is the suffix for the name of the configuration file to use. If it is omitted, the configuration file ~/.smd/config.default is used.
FILES
~/.smd/config.* ~/.smd/hooks/pre-push.d/ ~/.smd/hooks/post-push.d/
SEE ALSO mddiff(1), smd-server(1), smd-client(1), smd-pull(1), smd-loop(1), smd-config(5)AUTHOR
Enrico Tassi <gares@fettunta.org>
11 June 2012 smd-push(1)