Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can move one file from one directory to another.

C++
rename("c:\\PASS\\airport.zip", "c:\\Users\\DS\\Downloads\\airport.zip");


But how do I move whatever file(s) is in a directory to another. I tried this and it doesn't work.

C++
rename("c:\\PASS\\*.*", "c:\\Users\\DS\\Downloads\\*.*");
Posted
Comments
Member 10324160 8-Oct-13 20:23pm    
how do i download this?

1 solution

Use:
C++
rename("c:\\PASS", "c:\\Users\\DS\\Downloads");
 
Share this answer
 
v2
Comments
Mehdi Gholam 3-Nov-11 11:43am    
my 5!
André Kraak 3-Nov-11 11:45am    
Thanks, Mehdi.
Chuck O'Toole 3-Nov-11 11:55am    
Ah, are you sure? Doesn't rename in this form rename the folder itself and will fail if the destination folder already exists? So if "downloads" doesn't exist, then "pass" will be renamed and the original folder name is gone. I'm not sure that's what the OP wants.
Member 7766180 3-Nov-11 12:26pm    
Correct Chuck, I just want to move any file(s)from PASS to Downloads.
sonu sharma Oct2022 28-Nov-22 0:12am    
how create an application which move all the “JPG or JPEG” files from source directory to destination directory.
It will be a console application.
 First it will ask user to enter the source directory path ( where the different files are present)
 Once user enter the path , it will show the total count of “JPG or JPEG” files.
 After that it will ask user to enter destination directory path.
 Once user enter , move all files to destination directory path.
please suggest me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900