Need help with script to copy files from hfs+ (read-only) to ntfs (some chars not allowed)...
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.
Need help with script to copy files from hfs+ (read-only) to ntfs (some chars not allowed)...
I have some recovered files on an hfs+ drive (which is journaled, so I can only mount it read-only), that I need to copy to an ntfs drive so they can be accessed from a friend's windows machine. Unfortunately, there are a number of files with characters in the filenames that are allowed in hfs+, but not windows, so I need to batch rename them before they can be written to the ntfs drive, but without writing on the read-only drive.
My current thought is to use rename's -n option, which prints a list of files that will be renamed to stdout, and use that list with copy to change the name of each of those files.
Can someone help me out with what commands might be needed to send info from that list to copy for the right file in each case? Or is there a better/safer way to do this?
The mv command deletes the original file, though, doesn't it? So I can't use mv because the originating filesystem is read-only. I can't use rename alone because it doesn't move the files and I can't rename the files before I copy or move them because, again, the originating filesystem can only be mounted read-only. Or am I missing something there?
I know nothing about hfs+, but reasoning suggest that if you copy to a different location, then the original is only being read on the source, and the write is being done elsewhere, therefor it suggest that it is possible to just read then write to a different location giving the file a different (compatible) filename.
testing will revile the truth of this matter.
yes delete removes the original file, so copy is the thing you'll want to do. It is late here, I'd have to test the commands to get it to work myself.
The you can have find call a shell and work with in that. Or if that is too compex then you can have it call a shell script. Here is just a shell which replaces the vowels:
The mv command deletes the original file, though, doesn't it? So I can't use mv because the originating filesystem is read-only. I can't use rename alone because it doesn't move the files and I can't rename the files before I copy or move them because, again, the originating filesystem can only be mounted read-only. Or am I missing something there?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.