Flux rss
Search : in
By : Keywords Username
Unanswered messages

Creating new folders and moving,renaimg files

swampdonkey, on Monday September 15, 2008 03:12:22 AM 
 Report this message to moderators

Hello,

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!

Configuration: Windows XP
Firefox 3.0.1

1

platinump2, on Monday September 15, 2008 10:13:14 AM
  • +6

Will you use the system on a network or something like that?

Reply to platinump2

2

swampdonkey, on Wednesday September 17, 2008 04:21:52 AM
  • +1

I will copy it off the network onto an external harddrive.

Reply to swampdonkey

9

 raisalvador, on Wednesday May 13, 2009 08:32:57 AM
  • +3

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package maintenance;

import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
*
* @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);
if(!source.exists()){
System.out.println("File or directory does not exist.");
System.exit(0);
}
String dest = "C:\\try";
File destination = new File(dest);
if(!destination.exists()){
System.out.println("destination dir doesnt exists");
destination.mkdir();

}
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());
if(!destDir.exists()){
destDir.mkdir();
System.out.println("destination dir:"+destDir);
}
for(File sourceChild:children){
//System.out.println(sourceChild.getName());
String name = sourceChild.getName();
System.out.println("Filename:"+name);
File destChild = new File(destDir,name);
if(sourceChild.isDirectory()){
System.out.println("test sourceChild"+sourceChild.isDirectory());
copyDirectory(sourceChild, destChild);
}
else{
copyFile(sourceChild, destChild);
}

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

InputStream in = null;
OutputStream out = null;
try{

in = new FileInputStream(source);
out = new FileOutputStream(dest);
byte[] buf = new byte[1024];
int len;
while((len=in.read(buf))>0){
out.write(buf, 0, len);
}
}
finally{
in.close();
out.close();
}
}

}

Reply to raisalvador

3

bigd519, on Saturday January 17, 2009 04:44:19 AM

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.

Reply to bigd519

4

pasaway, on Friday January 23, 2009 09:13:21 PM
  • +1

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

Reply to pasaway

5

Bert, on Monday January 26, 2009 11:20:45 PM
  • +1

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!

Reply to Bert

6

marinegundoctr, on Sunday February 8, 2009 07:49:29 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.

Reply to marinegundoctr

7

raisalvador, on Wednesday March 4, 2009 10:01:16 AM
  • +2

I would suggest doing it in java... need help.. i could send a custom software to do it... call me +639268919248

Reply to raisalvador

8

raisalvador, on Friday March 13, 2009 06:22:31 AM
  • +3

Is the request still active.... before i post the java code?

Reply to raisalvador
Create Multiple folders under a folder Hello, Hello, I have a folder named data with thousands of folders. I need to create a folder e.g test in all those thousands of folders. Is there a way to do this through a batch file or something. Thanks en.kioskea.net/forum/affich-13386-create-multiple-folders-under-a-folder
New folder.exe Hello, my pc is suffers from new folder.exe i tried many antivirus to remove it but it couldn't. plz help me. en.kioskea.net/forum/affich-53734-new-folder-exe
Create and Open a RAR file Create and Open a RAR file How to create a RAR file How to open a RAR file RAR is an archive file format that is used during data compression, error recovery and file spanning. RAR is the acronym for Roshal Archive, inspired by... en.kioskea.net/faq/sujet-143-create-and-open-a-rar-file
How to read and create a BIN and CUE file?How to read and create a BIN and CUE file? What is a BIN file? How to create BIN and CUE files How to burn BIN and CUE files How to read/convert BIN and CUE files What is a BIN file? A BIN and CUE file together create a binary... en.kioskea.net/faq/sujet-264-how-to-read-and-create-a-bin-and-cue-file
Change the default installation folder C: \ Program FilesChange the default installation folder C: \ Program Files The installation of most software programs are set by default in the C: \ Program Files. Below is a means of how to change into another partition. Under Windows Vista, select... en.kioskea.net/faq/sujet-1328-change-the-default-installation-folder-c-program-files
Youtube refuse to accept video created with Windows Movie MakerYoutube refuse to accept video created with Windows Movie Maker The most common error is due to the fact that the video is still in Windows Movie Maker format and was not exported in a standard format. To be accepted, the video must be... en.kioskea.net/faq/sujet-1475-youtube-refuse-to-accept-video-created-with-windows-movie-maker
Got viruses named gphone.exe& new folder.exeHello, i have got viruses named gphone.exe and new folder.exe in my laptop through apen drive.these viruses are not being detected my anti-virus (AVAST anti-virus).and neither it is going out from my laptop nor from my pen drive. i have scanned my... en.kioskea.net/forum/affich-69576-got-viruses-named-gphone-exe-new-folder-exe
New Folder VirusHello, when ever i open a folder in my personal system, i find a new folder or a folder with the same name inside the original folder. even though i remove the same, it again emerges. this has come innto my pc through a pen drive. i have to clean my... en.kioskea.net/forum/affich-105301-new-folder-virus
Creating multiple folders in the file name usHello, Is there a program for Mac OS X, is capable of creating multiple folders in the file name using a text, "Because I have to create multiple folders and I do not want to spend much time doing one by one. if someone can help me I am grateful thank... en.kioskea.net/forum/affich-52977-creating-multiple-folders-in-the-file-name-us
Download Locked Files Wizard (ex CopyLock) A program, a folder or a fil used by a process can't be moved or erased. Locked Files Wizard (LFW) is a wizard allowing to move, delete or rename a file or a folder, even if it's used by a process. This program also allows to stop running process... en.kioskea.net/telecharger/telecharger-343-locked-files-wizard-ex-copylock
File sharing in Windows XPAdvantages File sharing involves making the content of one or more directories available through the network. All Windows systems have standard devices making it easy to share the content of a directory. However, file sharing may lead to security... en.kioskea.net/contents/configuration-reseau/partage-fichiers.php3
UNIX - FilesIntroduction to UNIX files In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/". File types UNIX systems define different... en.kioskea.net/contents/unix/unix-fichiers.php3