want to move set of file from one folder to another folder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting want to move set of file from one folder to another folder
# 1  
Old 08-23-2011
want to move set of file from one folder to another folder

Hi all,

let me explain my requirments

i am having 5 folder with different name for eg) abc , cdf , efd, rtg, ead

each 5 folders contain 15 files

i want to move 10 files to some other folder, remain 5 files should be there in the same folder.

give me some suggestion on this.
# 2  
Old 08-23-2011
Any criteria on which 10 files to pick and which 5 to leave?
# 3  
Old 08-23-2011
last 5 days file should be there and remaining need to move
# 4  
Old 08-23-2011
Code:
 
find .  -type f -ctime +5 mv {} destination_path \;

# 5  
Old 08-23-2011
thnks panyam

but my criteria is

i am having 5 folder with different name
e.g)

folder 1 --> 123/abc/(15 day files)
folder 1 --> 123/cdb/(15 day files)
folder 1 --> 123/qwe/(15 day files)
folder 1 --> 123/dfg/(15 day files)
folder 1 --> 123/qsd/(15 day files)


where 123 is the parent folder for abc,cbd,qwe,dfg,qsd

all the five folders having 15 days file , in that except last 5 days

i need to zip the remaining days files and move to different folder ......

---------- Post updated at 05:28 AM ---------- Previous update was at 05:16 AM ----------

auctually i tried , but i could find for 5 directories ......

any suggestion plz
# 6  
Old 08-23-2011
Code:
 
cd 123
find . -type f -mtime +5 -exec mv {}  /tmp/dest \;
 
find /tmp/dest  -type f -mtime +5 -exec gzip {}  \;

# 7  
Old 08-23-2011
thanks a lot panyam

thnks for ur quick replay
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move matching file to folder in same directory

The below bash executes but nothing is copied. I am trying to cp or mv the matching .pdf to the corresponding folder. There will always be a matching .pdf found but the number of folders may vary. The portion in red is what is used to match the .pdf--- variable $pdf to the folder--- variable... (11 Replies)
Discussion started by: cmccabe
11 Replies

2. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies

3. Shell Programming and Scripting

Move files from Space Folder to other folder

I want to move a folder with spaces from one folder to another. I have two folders like this, 1).RT_032-222 -4444-01/ 2). RT_032-555 -7777-01/ I want to move files from 2 to 1 through shell script.Here I want to assign this like a user defined variable like as Source branch... (2 Replies)
Discussion started by: kannansoft1985
2 Replies

4. Shell Programming and Scripting

Script to move one folder to multiple folder...

Hi All, I have to requirement to write a shell script to move file from one folder (A) to another five folder (B,C,D,E,F) and destination folder should be blank. In not blank just skip. This script will run as a scheduler every 2 minutes. It will check number of files in folder A and move 1 to... (9 Replies)
Discussion started by: peekuabc
9 Replies

5. Shell Programming and Scripting

Folder to Folder move

Hi, I need a little help with this one; Let's say I have two directories /dir1/dir2/dir3old and /dir1/dir2/dir3new Within dir3old and dir3new are many folders, each containing some files. How can I search all the sub folders in dir3old for files of a specific date and move the files to the... (1 Reply)
Discussion started by: bbbngowc
1 Replies

6. Shell Programming and Scripting

FTPS Script to move a file to Unix Folder

Dear Experts, I need to connect to a FTPS Server and move the files from FTPS folder "/SAP/Out" to Unix directory "/SAP/In". I need to run this script on Unix directory...Script should get the files from FTPS folder and place that in specified Unix Directory. Thanks In Advance. (1 Reply)
Discussion started by: phani333
1 Replies

7. Shell Programming and Scripting

Search through subfolders and move them into separate folder on the base of file size

Hello guys I am sure that you will help me on this issue as you did earlier::) Scenario : I have a folder named "XYZ". It consist many sub-folders and subfolder contain severals files. there may be abc.dat in each subfolder. Now i want to seperate subfolders on follwing conditions- if abc.dat... (12 Replies)
Discussion started by: infiant
12 Replies

8. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

This is the file structure: DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies

9. Shell Programming and Scripting

Move the file from one folder to another folder

Hi, I have a requirement to move a file from one folder(a) to another folder(b) only when folder (b) have a write permission. Folder permission is 755 If the permission is otherthan 755 we need to come out of the loop I will appreciate your help Thanks Soll (1 Reply)
Discussion started by: sollins
1 Replies

10. Shell Programming and Scripting

Parse the .txt file for folder name and FTP to the corrsponding folder.

Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)
Discussion started by: MeganP
3 Replies
Login or Register to Ask a Question