Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 05-27-2004, 11:00 AM   #1
Member (7 bit)
 
Join Date: Dec 2002
Location: Chicago
Posts: 122
Send a message via AIM to achilipepper
smokin Renaming files in JAVA?

ok so here i am at work, openning folder after folder, renaming file after file....
i have a good knowledge of JAVA (degree in computer science), but i dont know how to do the following:
1. with a given directory, get an array of the folders in it
2. open one of the folders, get an array of the files inside, rename each file
basically i need to rename each file to the name of the folder they reside in with a -1, -2, -3, -4, -5, etc appended to the end, then repeat for the next folder of files. seems easy enough, i just dont know the above steps.

help!
achilipepper is offline   Reply With Quote
Old 05-27-2004, 06:28 PM   #2
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Check out the File class:
http://java.sun.com/j2se/1.4.2/docs/...a/io/File.html


It has methods for enumerating directory contents (listFiles), and renaming files (renameTo).

If you need more help on those methods, just post
aym is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:55 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2