Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Moving files and directories in C++?

SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
The topic says it all. I don't have time to wait for the official ext4 defrag utility so I am going to write one that I can use temporarily. Basically, I want the user to specify a partition or directory to be defragmented and have my program move the directory or partition contents to an external HDD or, if it is large enough, temporary directory/partition, then start moving things back in alphabetical order. Since Linux will not fragment files during a move, this should take fragmented files and plop them back together, as well as sorting them alphabetically.

My problem lies within moving stuff using C++. I canot figure out how to do it. All I can find on Google are people taking shortcuts and using the system call to invoke "mv". I want my program to function properly though, with no shortcuts. Can somebody help me figure out how to move a directory-tree, including files, to a specified location? How about just moving individual files?

Sign In or Register to comment.