Creating new folders and moving,renaimg files

swampdonkey Posts 1 Registration date Sunday September 14, 2008 Status Member Last seen September 14, 2008 - Sep 14, 2008 at 10:12 PM
 Arun - Oct 27, 2011 at 05:07 PM

I need some with a code to help create 4,000 folders (1,000 dir, 3,000 sub dir) then move and rename over 35,000 files. I have a list of old paths and new paths in an Access 2003 db. They will also need to be moved from different network drives. Can anyone help?

Thanks in advance!

7 responses

platinump2 Posts 10 Registration date Thursday May 15, 2008 Status Member Last seen October 18, 2008 7
Sep 15, 2008 at 05:13 AM
will you use the system on a network or something like that?
I will copy it off the network onto an external harddrive.
raisalvador > swampdonkey
May 13, 2009 at 03:32 AM
* To change this template, choose Tools | Templates
* and open the template in the editor.

package maintenance;


* @author ryan.o.salvador
public class Main {

* @param args the command line arguments
public static void main(String[] args) throws IOException {
// TODO code application logic here
String src = "D:\\try";
File source = new File(src);
System.out.println("File or directory does not exist.");
String dest = "C:\\try";
File destination = new File(dest);
System.out.println("destination dir doesnt exists");

copyDirectory(source, destination);

private static void copyDirectory(File sourceDir, File destDir) throws IOException{
System.out.println("Copying directory");

File[] children = sourceDir.listFiles();
System.out.println(destDir +" exists:"+destDir.exists());
System.out.println("destination dir:"+destDir);
for(File sourceChild:children){
String name = sourceChild.getName();
File destChild = new File(destDir,name);
System.out.println("test sourceChild"+sourceChild.isDirectory());
copyDirectory(sourceChild, destChild);
copyFile(sourceChild, destChild);

private static void copyFile(File source, File dest) throws IOException{
System.out.println("Writing file :"+source.getPath()+" to: "+dest.getPath());

InputStream in = null;
OutputStream out = null;

in = new FileInputStream(source);
out = new FileOutputStream(dest);
byte[] buf = new byte[1024];
int len;
out.write(buf, 0, len);

Good job..Thank you
is the request still active.... before i post the java code?
First, create folders called, documents, pictures, power points, excel, movies, music. then move all the doc to the folder document, all the photos to the folder pictures and so on. leaving the desktop or wherever you run the program organized.

The program can ask first to create a folder name, then the command to move what files to that directory.

Good luck!
I dont think there is any commercially available software to do it.

The only way in theory to do it MAYBE is to create a batch file which is basically an automated script. you can do this in notepad.

If you dont know how to create batch files theres not much point in trying to learn as you need to learn alot of program line commands and it would take forever

maybe sort the file types? and then set up directories?

good luck.
if you need an automatic program to move from the old folders to the new folders based on your access DB contents I think that unfortunately the only way is as said our friend before to write a script.
However if you can not write ths kind of stuff, you could be helped using "the rename" tool (freeware), that will allow you to rename folders and files in a mass update mode.
So if there is a logic in the job you want to accomplish, "therename" can be of a great help
Bert > pasaway
Jan 26, 2009 at 06:20 PM
I would suggest TotalComander it is freeware and will move entire File Tree's from one location to another (whilst maintaining permissions/structure etc) and then the renaming you may have to do manually at the other end? I'm sure you have your reasons for wanting to rename a thousand directories ... but this is by far the easiest way to move the file structure!

Didn't find the answer you are looking for?

Ask a question
Feb 8, 2009 at 02:49 PM
I would use ICE Mirror (free software) to mirror the existing directory structure to the new drive, then use something like (my favorite) FlashRenamer to do the renaming. It can rename directories, filenames, extensions, and even allow you to set up a batch script. It has a good help file with all of the scripting commands it uses. Very adaptable. Your best bet is going to be doing this in steps rather than copy and rename unattended.
I would suggest doing it in java... need help.. i could send a custom software to do it... call me +639268919248
uhhhh... i have been making bacth file "fake" viruses to see if i can do it and most of them come out like the snapshot in the tuiturails.