Moving folders with script


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu Moving folders with script
# 1  
Old 02-08-2010
Java Moving folders with script

Hi All,

I am new to Forums, as i am struggling for one script i am launched here.

I need to move more than 60,000+ folders in 1,00,000 folders to another server. I have the list of folders which should be moved. can anybody help me in sharing with the script for the above requirement.

Regards,
Hima Kiran
# 2  
Old 02-08-2010
Be more precise - all 60.000 in other 1.000.000 each or by some distributing mechanism or or or... we need more info. If move with wildcards is not sufficient cause of limited number of parameters/arguments, you might want to use some find/exec/mv line to do it.
If it is a distribution logic that can't be done by algorithm logics, you might want to do it manually but let us know please, what details you have.
# 3  
Old 02-08-2010
Dear Zaxxon,

In my organization we are using Postfix as a mail server. I have be told to clean up old mail boxes with backup. There are more than 1,00,000 id's present in our server. now i have list of users (folders) name which first i have to take backup (copy to backup location) and delete the folders.

Regards,
Hima Kiran
# 4  
Old 02-08-2010
Do they have all one backup location or different ones? If only one then you can try something like this:

Code:
while read LINE; do cp -rp $LINE /backup_destination; done < my_list.txt

For this to work you need to cd to the directory where all those ids/users/folders are since in your list are only ids and not absolute paths, I guess.

You might also make sure first, that you have enough room at the backup destination. When everything is copied with errors, you can use similar while/read loop to empty (rm -rf) the old folders.

If you have different destinations/target, then you might want to use $LINE in combination with the backup path.
# 5  
Old 02-08-2010
MySQL

Dear zaxxon,

Thanks, it worked for me. timely support.

Regards,
Hima KiranSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Moving files and folders to another folder

I recently bought Synology server and realised it can run scripts. I would need fairly simple script which moves all files and folders from ARCHIVE folder to WORKING folder. I would also need to maintain folder structure as each of the folders may contain subfolders. How would I go about it as I am... (1 Reply)
Discussion started by: ###
1 Replies

2. Shell Programming and Scripting

Script for moving series of sub folders

Hello, I'm new to this forum. Did a search but I didn't quite find what I was looking for. This is probably a fairly easy request but I'm just not sure how to accomplish this. I have a folder structure that looks something like this:/names/company1/archive /names/company1/newarchive ... (4 Replies)
Discussion started by: vipertech
4 Replies

3. Shell Programming and Scripting

Moving files to folders and rename

Hello! I am new to this. I have many files from b_ap00 to b_ap80, and I need to move them to folder 00 to 80 respectively, where b_ap00 is in folder 00, b_ap01 is in folder 01. On top of this, I need to rename the file once they are inside the folder to b_ot, and subsequently run it (ifort -o... (8 Replies)
Discussion started by: krustytherusty
8 Replies

4. UNIX for Dummies Questions & Answers

Running a script from another script by moving directories

I have created this script and does not seem to be behaving well. Basically I am in a directory, I just want to do down two directories, run the script georom_replaceText.tcsh This will produce a file in the subdirectory, which I then run. Finally go back to where I started. Afterwards I... (4 Replies)
Discussion started by: kristinu
4 Replies

5. UNIX for Dummies Questions & Answers

script to create folders

hi again, having an issue with the code here because it doesnt work :D can someone point what and how to change, please. #!/bin/bash #create directory mylabs, inside create 6 directories named by user. DIR1="$1" DIR2="$2" if ; then echo -n " there is a folder named mylabs, what... (1 Reply)
Discussion started by: me.
1 Replies

6. UNIX for Dummies Questions & Answers

moving mail between IMAP folders

Hello all, I have a Cyrus IMAP server running on HP-UX. I have a requirement to run a script every night at midnight, which will take all the mail (read and unread mail) from one IMAP folder, and move it into a different IMAP folder. Both the source and destination IMAP folders belong to the... (1 Reply)
Discussion started by: lupin..the..3rd
1 Replies

7. Shell Programming and Scripting

moving files from one folder to many folders

I have a more than 10 K files in a folder. They are accumulated in a period of more than an year (Say from 13th July 2010 to 4th June 2011). I need to perform housekeeping on this. The requirement is to create a folder like 13Jul2010,14July2010,......3June2011,4June2010 and then from the main... (2 Replies)
Discussion started by: realspirituals
2 Replies

8. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

9. Red Hat

Moving folders

I'm new at this, so bare with me. I'm looking to move some folders, but keep the tree intact. Example: I have hundreds of folders in one directory (parent directory). In each folder there is a one folder called "source" and about 10 files. I want to move all the "Source" directories... (4 Replies)
Discussion started by: gnpower
4 Replies

10. Shell Programming and Scripting

moving multiple folders/files in subversion using bash script

Hi, I'm new here an dlearning a lot from this forum. i didnt find any solution for this in the forum. I have already checked in folders in subversion named HTT01,... HTT21.. and have files in each folder like below: HTT01/HTT01_00000.hex HTT01/HTT01_00000_fb_result.hex... (2 Replies)
Discussion started by: ravishan21
2 Replies
Login or Register to Ask a Question