Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a folder that is around 230GB and need to copy it to an external .
Drive that hold's data = NTFS.
External = Fat32.
when i used the CP command it gives me errors due to the name of ther files in that directory. some files names are just strange and contain special charaters such as & % $ _ , as i remember the error was invalid arguments .
i tried to TAR the file but it stoped at 4GB , with an error "File larger than 4GB " ..
Any current version of Linux should have no problem copying from NTFS to any other filesystem. I suspect that the problem is the special characters.
The general rule is to put the filename in quotes, like so:
cp "/path/funn&#filename" /destination/path/ (Depending on what the special characters are, you might need single quotes.)
You can also "escape" special characters. Suppose you had a file named "fred$dog". If you do:
cp fred$dog /dest/path
the shell will attempt to insert the value of the variable named "dog". To prevent that, do:
cp fred\$dog /dest/path
Personally, I would first rename the offending files. That way, you will not continue to have the same issue. Post some actual example of the "strange" filenames.
Any current version of Linux should have no problem copying from NTFS to any other filesystem. I suspect that the problem is the special characters.
The general rule is to put the filename in quotes, like so:
cp "/path/funn&#filename" /destination/path/ (Depending on what the special characters are, you might need single quotes.)
You can also "escape" special characters. Suppose you had a file named "fred$dog". If you do:
cp fred$dog /dest/path
the shell will attempt to insert the value of the variable named "dog". To prevent that, do:
cp fred\$dog /dest/path
Personally, I would first rename the offending files. That way, you will not continue to have the same issue. Post some actual example of the "strange" filenames.
thank you for the advice . but i tried that.
now check this.
i have a folder named TEST . it has sub-folders and files which are around 400GB or so, you are looking at over 10000 files. i just need to copy the whole folder to an external drive. there should be a way to copy the whole folder .. thankx
thank you for the advice . but i tried that.
now check this.
i have a folder named TEST . it has sub-folders and files which are around 400GB or so, you are looking at over 10000 files. i just need to copy the whole folder to an external drive. there should be a way to copy the whole folder .. thankx
well imagine renaming and editing a 1000 files ? that would take so must time .
First thing you need to do is get a list of all the filenames with special chars; something like
Code:
for file in `ls`
do
echo $file |egrep -e '&' -e '@' # add in all the special chars you need
done
That'll give you a list of all the filenames (with special chars), which you can redirect to a file.
You then need to decide what amendments you want to make and extend the script to do that for you.
First thing you need to do is get a list of all the filenames with special chars; something like
Code:
for file in `ls`
do
echo $file |egrep -e '&' -e '@' # add in all the special chars you need
done
That'll give you a list of all the filenames (with special chars), which you can redirect to a file.
You then need to decide what amendments you want to make and extend the script to do that for you.
thank you very much . But again i wanted something in and out. just like a command that would just copy the whole thing one shot.
First thing you need to do is get a list of all the filenames with special chars; something like
Code:
for file in `ls`
do
echo $file |egrep -e '&' -e '@' # add in all the special chars you need
done
That'll give you a list of all the filenames (with special chars), which you can redirect to a file.
You then need to decide what amendments you want to make and extend the script to do that for you.
thank you very much . But again i wanted something in and out. just like a command that would just copy the whole thing one shot.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.