Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [SOLVED] Delete files and folders under given directory Post 302552809 by DGPickett on Monday 5th of September 2011 05:06:07 PM
Old 09-05-2011
Rather serial, one rm per dir is nicer:
Code:
(
for d in */*/
do
 ksh -c "rm ${d}*" &
done
wait
)

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete all folders/files and keep only the last 10 in a folder

Hi, I want to write a script that deletes all folders and keep the last 10 recent folders. I know the following: ls -ltr will sort the folders from old to recent. ls -ltr | awk '{print $9}' will list the folder names (with a blank line at the beginning) I want to get the 10th folder from... (3 Replies)
Discussion started by: melanie_pfefer
3 Replies

2. Shell Programming and Scripting

delete files and folders older than 3 days

find /basedirectory -type f -mtime +3 >> /tmp/tempfile find /basedirectory -type d -mtime +3 >> /tmp/tempfile mailx -s "List of removed files and folders" myemail@domain.com < /tmp/te mpfile rm /tmp/tempfile find /basedirectory -type f -mtime +3 -exec rm {} \; find /basedirectory -type d... (7 Replies)
Discussion started by: melanie_pfefer
7 Replies

3. Shell Programming and Scripting

Compare files in two folders and delete missing ones

I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great! I have two directories /dir1 /dir2 I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
Discussion started by: kaah
20 Replies

4. UNIX for Dummies Questions & Answers

Delete folders and files in it - UNIX

I need to delete a folder and files in it of yesterdays and simply put this in cron. Folder name - "2010-03-2010" File name - "eprod_06_23.dmp" and "eprod_06_23.exp" Actually this folder and file is been created by a script which takes a backup of DB everyday.Thats why it creates folder and file... (3 Replies)
Discussion started by: j_panky
3 Replies

5. Shell Programming and Scripting

delete folders with no mpgs or nuv files

I need some help writing a simple script that will delete all subfolders that contain no mpg or nuv files, if they have anything else or are empty the folder should be deleted I got this far but I'm pretty hopeless foo=0 if then foo=1 fi if then foo=1 fi if then echo found... (9 Replies)
Discussion started by: mrplow
9 Replies

6. Shell Programming and Scripting

Loop folders, delete files, copy new ones

Folks, I am hopeful that you may be able to help me out with writing a script that can be run nightly (as cron?) to loop through all subfolders within the "/media" directory, delete all of the files in each of them, and then copy in all of the files from the "/home//sansa" directory to each of... (6 Replies)
Discussion started by: acraig
6 Replies

7. Shell Programming and Scripting

Delete multiple folders in a directory which are two weeks old

I need help. I have to delete multiple directories inside a directory that are two weeks old. Example: Today is July 09, 2012 Folder1 > folder1 (created June 4, 2012) -- should be deleted > folder2 (created June 2, 2012) -- should be deleted > folder3 (created... (4 Replies)
Discussion started by: jasperux
4 Replies

8. Shell Programming and Scripting

Copy the files in directory and sub folders as it is to another directory.

How to copy files from one directory to another directory with the subfolders copied. If i have folder1/sub1/sub2/* it needs to copy files to folder2/sub1/sub2/*. I do not want to create sub folders in folder2. Can copy command create them automatically? I tried cp -a and cp -R but did... (4 Replies)
Discussion started by: santosh2626
4 Replies

9. Shell Programming and Scripting

Script to delete folders and files from a prompt

Hi Everyone, I work for GE Money IVR as a DB analyst and the environment on which I work is Solaris 5.0 server and Oracle 11g. I got a project in which I have to clean up the folders and files which are not used in DB. I copied an existing script and edited it, dont know this is the... (5 Replies)
Discussion started by: habeeb506
5 Replies

10. Shell Programming and Scripting

How to delete all the files and folders inside all the directories except some specific directory?

hi, i have a requirement to delete all the files from all the directories except some specific directories like archive and log. for example: there are following directories such as A B C D Archive E Log F which contains some sub directories and files. The requirement is to delete all the... (7 Replies)
Discussion started by: Little
7 Replies
MB2MD(1)						      General Commands Manual							  MB2MD(1)

NAME
mb2md -- Converts Mbox mailboxes to Maildir format. SYNOPSIS
mb2md [-h] mb2md [-c] [-m] [-d destdir] mb2md [-c] [-s sourcefile] [-d destdir] mb2md [-c] [-s sourcedir] [-l wu-mailboxlist] [-R|-f somefolder] [-d destdir] [-r strip_extension] DESCRIPTION
mb2md Converts Mbox mailboxes to Maildir format. OPTIONS
-h Show summary of options. -c Use the Content-Length: headers (if present) to find the beginning of the next message. Use with caution! Results may be unreli- able. I recommend to do a run without "-c" first and only use it if you are certain, that the mbox in question really needs the "-c" option. -m If this is used then the source will be the single mailbox at /var/spool/mail/blah for user blah and the destination mailbox will be the "destdir" mailbox itself. -s sourcedir Directory, relative to the user's home directory, which is where the the "somefolders" directories are located. Or if directory starts with a "/" it is taken as a absolute path, e.g. /mnt/oldmail/user _OR_ A single mbox file which will be converted to the destdir. -R If defined, do not skip directories found in a mailbox directory, but runs recursively into each of them, creating all wanted folders in Maildir. Incompatible with '-f' -f somefolder Directories, relative to "sourcedir" where the Mbox files are. All mailboxes in the "sourcedir" directory will be converted and placed in the "destdir" directory. (Typically the Inbox directory which in this instance is also functioning as a folder for other mailboxes.) The "somefolder" directory name will be encoded into the new mailboxes' names. See the example in the USAGE file (see below). This does not save an UW IMAP dummy message file at the start of the Mbox file. Small changes in the code could adapt it for looking for other distinctive patterns of dummy messages too. Don't let the source directory you give as "somefolders" contain any "."s in its name, unless you want to create subfolders from the IMAP user's point of view. See the example in the USAGE file (see below). Incompatible with '-R' -d destdir Directory where the Maildir format directories will be created. If not given, then the destination will be ~/Maildir . Typi- cally, this is what the IMAP server sees as the Inbox and the folder for all user mailboxes. If this begins with a '/' the path is considered to be absolute, otherwise it is relative to the users home directory. -r strip_extension If defined this extension will be stripped from the original mailbox file name before creating the corresponding maildir. The extension must be given without the leading dot ("."). See the example in the USAGE file (see below). -l WU-file File containing the list of subscribed folders. If migrating from WU-IMAP the list of subscribed folders will be found in the file called .mailboxlist in the users home directory. This will convert all subscribed folders for a single user: /bin/mb2md -s mail -l .mailboxlist -R -d Maildir and for all users in a directory as root you can do the following: for i in *; do echo $i;su - $i -c "/bin/mb2md -s mail -l .mailboxlist -R -d Maildir";done USAGE
Please read the USAGE documentation (zless /usr/share/doc/mb2md/USAGE.gz). AUTHOR
This manual page was written by Noel Kothe noel@debian.org for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version pub- lished by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. MB2MD(1)
All times are GMT -4. The time now is 09:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy