473,513 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copying files from 1 folder to other folder??

111 New Member
Hii all,

i have a source folder, i have many .jpg files ..

Now i want all the .jpg files to be copied into new folder...

can anyone plz help me....


How to copy all the files from 1 folder to other folder with renaming the file names that are present in the source folder....??????


thnx...
hepsi..
Sep 13 '07 #1
3 1215
vikramadith
12 New Member
Quite simple mate, you ought to have googled it. ;)

Expand|Select|Wrap|Line Numbers
  1. DirectoryInfo dir=new DirectoryInfo(folderPath);
  2. foreach(FileInfo file in dir.GetFiles())
  3.        file.CopyTo(destinationFolder+filename);
If you want only jpg files, you can check the FileInfo.Extension before copying.
Sep 13 '07 #2
rhepsi
111 New Member
Quite simple mate, you ought to have googled it. ;)

Expand|Select|Wrap|Line Numbers
  1. DirectoryInfo dir=new DirectoryInfo(folderPath);
  2. foreach(FileInfo file in dir.GetFiles())
  3.        file.CopyTo(destinationFolder+filename);
If you want only jpg files, you can check the FileInfo.Extension before copying.

Thnx for ur reply... ive found tht..

Now my requirement is such tht...

I have to rename them...

is there any way out..???

thnx..
hepsi..
Sep 13 '07 #3
vikramadith
12 New Member
Sure, in the code I posted, the 'fileName' variable is something that you can change as you like.
Sep 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1706
by: Terry | last post by:
I am trying to move a datbase from one machine to another. I have tried two different methods and neither are working. First I tried using : >> mysqldump dbName > backup_file.sql >> mysql...
5
2335
by: TB | last post by:
Hi All: This news group is proving to be great help on my path towards mastering ASP.NET thanks to all of you helpful souls out there. I am looking forward to the day when I can contribute...
10
7804
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
4
1396
by: tshad | last post by:
I have an old version of VS 2002 and want to make a copy of my Visual Studio project to another project with another name. In VS 2003, you can do it but there is no copy project command in VS 2002...
3
1339
by: Jeries Shahin | last post by:
Hi I am trying to copy files from a folder on a Novel machine, the folder is in the UMC format (i cannot map a network drive for some business reasons). Upon copying, it fires an IOException...
1
2316
by: Israel | last post by:
I'll preface this by saying that my preference is to dump a database to SQL and transfer that file around but this is not the situation that I'm in and I'll probably be in this situation in...
2
7966
by: Jerad Rose | last post by:
I have a fairly simple C# console app which copies files from a network folder to a local folder. When the app resides on my local C: drive, it runs just fine. However, when the app resides on a...
0
2494
by: AmyHanson | last post by:
I am new to mobile development and am having some trouble sources for the tasks I need to perform. I have been looking around and I can find plenty of information on copying the file initiating on...
13
10569
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7539
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.