07-29-2015
Its not a homework question. I got a small task of clearing all the old files from all the directories except archive. Instead of going to each 200+ directories and deleting the files manually, thought of writing a script. Can someone please help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have a directory "ABC" with lots of old files and sub directories in it.
the issue now is i want to delete away files which are older than 15 days in "ABC" without deleting the files in the sub directories and without deleting the sub directory.
i tried using find command but it will drill down... (2 Replies)
Discussion started by: legato
2 Replies
2. Solaris
I am using the following Command to delete Directory with contents. But this command is deleting inside files only not directories. is there any change need in my command?
find -type f -mtime +3 -exec rm -r {} \;
Thanks (3 Replies)
Discussion started by: bmkreddy
3 Replies
3. Shell Programming and Scripting
Hi All,
I am trying to rsync some of the latest files from remote m/c to my local linux box.
Folder structure in my remote m/c looks like this
/pub/Nightly/Package/ROLL/WIN
/pub/Nightly/Package/SOLL/sol
/pub/Nightly/Package/SOLL/linux
Each of the folder contains gzip files which on daily... (0 Replies)
Discussion started by: jhoomsharabi
0 Replies
4. Shell Programming and Scripting
Hello,
I have several files in a specific directory.
A specific string in one file can occur in another files.
If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string.
Example.
file1
ShortName "Blue... (2 Replies)
Discussion started by: premier_de
2 Replies
5. UNIX for Dummies Questions & Answers
I have a requirement to delete the files and folders under a given directory.
my directory structure is like this..
Data
|
A(Directory)
|_PDF(Directory)----pdf files
|_XML()Directory --xml files
|--files
|
B(Directory)
|_PDF(Directory)----pdf files
|_XML()Directory --xml files ... (1 Reply)
Discussion started by: ramse8pc
1 Replies
6. Shell Programming and Scripting
Hi,
I have to find specific files only in the current directory...not in the sub directories.
But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help..
I am using the below command. And i am... (2 Replies)
Discussion started by: aakishore
2 Replies
7. Shell Programming and Scripting
I'm sure this has been asked many times, but a search didn't turn up a definitive best method for this (if there ever is such a thing).
I have been using rsync to back up my main data directory, but I have accumulated a large number of older backups that I don't need. All of the files I don't... (14 Replies)
Discussion started by: LMHmedchem
14 Replies
8. Shell Programming and Scripting
he following are the files available in my directory
RSK_123_20141113_031500.txt
RSK_123_20141113_081500.txt
RSK_126_20141113_041500.txt
RSK_126_20141113_081800.txt
RSK_128_20141113_091600.txt
Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies
9. Shell Programming and Scripting
I am trying to move specific folders and subfolders within a directory using the below. I can see the folders to move and they are at the location, but I am getting an error. Thank you :).
mv -v /home/cmccabe/Desktop/NGS/API/6-10-2016{bam/{validation,coverage},bedtools /media/cmccabe/"My... (6 Replies)
Discussion started by: cmccabe
6 Replies
10. Shell Programming and Scripting
The below bash is trying to list the folders in a specific directory. It seems close but adds the path to the filename, which basename could strip off I think, but not sure why it writes the text file created? This list of folders in the directory will be used later, but needs to only be the... (5 Replies)
Discussion started by: cmccabe
5 Replies
LEARN ABOUT OSF1
shtrashcan
mktrashcan(1) General Commands Manual mktrashcan(1)
NAME
mktrashcan, rmtrashcan, shtrashcan - Attaches, detaches, or shows a trashcan directory
SYNOPSIS
/usr/sbin/mktrashcan trashcan directory...
/usr/sbin/rmtrashcan directory...
/usr/sbin/shtrashcan directory...
OPERANDS
Specifies the directory that contains files that were deleted from attached directories. Whenever you delete a file in the specified
directory, the file system automatically moves the file to the trashcan directory. Specifies the directory that you attach to a trashcan
directory.
DESCRIPTION
The trashcan utilities (mktrashcan and rmtrashcan) enable you to attach or detach an existing directory, which you specify as a trashcan
directory, to any number of directories within the same fileset.
A trashcan directory stores the files that are deleted with the unlink system call. For instance, you can use the mktrashcan utility to
attach a trashcan directory called /usr/trashcan to one or more directories; thereafter, when you delete a file from one of the attached
directories, the file system moves the file to the /usr/trashcan directory. Note that when more than one directory shares attachment to a
trashcan directory, files with the same file name can overwrite each other in the trashcan directory.
If you mistakenly delete a file, use the mv command to return the file from the /usr/trashcan directory to its original directory.
When you enter shtrashcan at the system prompt, the system shows the trashcan directory, if one exists, for the directory you specified.
It is important that trashcan directories have correct access permissions. If the permissions are too restrictive, then it may be impossi-
ble to remove files from the directories that are attached to the trashcan directory. In general, all users and groups that expect to use
the trashcan directory need write permission to the directory. If unexpected "permission denied" errors occur when deleting files that are
in a directory attached to a trashcan directory, use the chmod command to change the permissions on the trashcan directory.
RESTRICTIONS
The directory and trashcan directories must be in the same fileset; however, you can attach the trashcan directory to any directory within
the fileset.
EXAMPLES
The following example creates and attaches a trashcan directory, /usr/trashcan, to two directories, /usr/ray and /usr/projects/sql/test,
which are in the same fileset. The chmod command adds write permission for all users and groups on the new trashcan directory. % mkdir
/usr/trashcan % chmod a+w /usr/trashcan % mktrashcan /usr/trashcan /usr/ray /usr/projects/sql/test To attach the trashcan directory,
/usr/trashcan, to all subdirectories in the /usr directory, enter: % mktrashcan /usr/trashcan /usr/*
New subdirectories that you add beneath the /usr directory are not attached to the trashcan directory until you attach them. Also,
the mktrashcan utility distinguishes between directories and files, attaching only directories to the trashcan directory.
Note that an attached directory produces an EDUPLICATE_DIRS (-1165) error when /usr/trashcan is itself in the directory path you
attach to (as in the previous example). You can ignore this error message.
SEE ALSO
advfs(4), mkfset(8), showfsets(8)
mktrashcan(1)