Shell Scripting , Moving Old file to specific folder
There are files stored like 14.Aug.2014.log, 15.Aug.2014.log etc. in a folder $HOME/logyou need to find out all the log files of last 1 month and move them into $HOME/logs/lastmonth/
this should be implemented with reference of file name.
---------- Post updated at 12:30 PM ---------- Previous update was at 12:00 PM ----------
Sol.
but for above solution my boss has said that
What if there are lakhs of log files in that directory.
Can you think of a way to iterate not more than 30 times?
This is not efficient.
Can some one suggest me to proper way for this
Last edited by Don Cragun; 09-14-2014 at 04:51 AM..
Reason: Add CODE and ICODE tags.
Hi ,
I need a shell script which basicaly moves all the files from one folder say folder x to folder y and once they are moved to folder y a datetimestamp should be attached to there name
for ex
file a should be moved to y folder and renamed as a_20081015 (1 Reply)
i have created file in one of the folders on unix
UNIX 's36tou -T XYZ /tmp/p400/dataout/ias/AB >/dev/null
I am using above command to copy file from one system to unix
XYZ is name of file on my system usually this name is very big so i use -T to trim some charaters from name.
noe... (1 Reply)
Hi,
I need to move 1000s of files from one folder to another.
Actually there are 100K+ files.
Source dir : source1
Target dir : target1
Now if try cp or mv commands I am getting an error message : Argument List too long.
I tried to do it by the time the files are created in the source... (6 Replies)
hye there...
i have a problem to copy file in specific folder
that will change the name according to
host,time(%m%s) and date(%Y%M%D)
example folder name:
host_20100531.154101801
this folder name will always change...
but i just want to copy the AAA.txt and BBB.txt file..
really need... (17 Replies)
Hi Experts,
I have a "Source" folder which may contain some files. I need a shell script which should move all files which are older than 3 days to "Archive" folder.
Thanks in Advance... (4 Replies)
Hi
I'm trying to look through a series of directories in A folder, lets just call it A:
for example:
A/1
A/2
A/3
Etc and I wish to move the files in the folder if they are bigger than a certain size into a structure like below:
A/TooBig/1
A/TooSmall/1
A/TooBig/2
A/TooSmall/2... (1 Reply)
I need a script which should watch a directory for a file with specific directory.
If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column.
The file should be moved to another directory and the a... (8 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
There are files stored like 14.Aug.2014.log, 15.Aug.2014.log etc. in a folder $HOME/log you need to find out all... (4 Replies)
I need help to write shell script to copy files from one server to another server.
Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Discussion started by: naresh2389
3 Replies
LEARN ABOUT LINUX
rmf
RMF(1) [nmh-1.5] RMF(1)NAME
rmf - remove an nmh folder
SYNOPSIS
rmf [+folder] [-interactive | -nointeractive] [-version] [-help]
DESCRIPTION
Rmf removes all of the messages (files) within the specified (or default) folder, and then removes the folder (directory) itself.
If there are any files within the folder which are not a part of nmh, they will not be removed, and an error will be produced. If the
folder is given explicitly or the -nointeractive option is given, then the folder will be removed without confirmation. Otherwise, the
user will be asked for confirmation. If rmf can't find the current folder, for some reason, the folder to be removed defaults to `+inbox'
(unless overridden by user's profile entry "Inbox") with confirmation.
If the folder being removed is a subfolder, the parent folder will become the new current folder, and rmf will produce a message telling
the user this has happened. This provides an easy mechanism for selecting a set of messages, operating on the list, then removing the list
and returning to the current folder from which the list was extracted.
If rmf s used on a read-only folder, it will delete all the (private) sequences (i.e., "atr-seq-folder" entries) for this folder from your
context without affecting the folder itself.
Rmf irreversibly deletes messages that don't have other links, so use it with caution.
FILES
$HOME/.mh_profile The user profile
PROFILE COMPONENTS
Path: To determine the user's nmh directory
Current-Folder: To find the default current folder
Inbox: To find the default inbox
SEE ALSO rmm(1)DEFAULTS
`+folder' defaults to the current folder, usually with confirmation
`-interactive' if +folder' not given, `-nointeractive' otherwise
CONTEXT
Rmf will set the current folder to the parent folder if a subfolder is removed; or if the current folder is removed, it will make "inbox"
current. Otherwise, it doesn't change the current folder or message.
BUGS
Although intuitively one would suspect that rmf works recursively, it does not. Hence if you have a sub-folder within a folder, in order
to rmf the parent, you must first rmf each of the children.
MH.6.8 11 June 2012 RMF(1)