Hi I am Rupesh from India and I am using android phone with memory card and a laptop with open suse leap 15.0 linux installed. I want to copy only selected files ie., with extension .mp3 from memory card to local drive.
I have a memory card with directory called music and it has sub directories which contains .m4a and .mp3. This particular directory called music is of size 100 GB. Most of the files are with extension .m4a with size 70 GB and remaining files are with extension .mp3 with size 30 GB.
Actually what my intention is to copy only only files with extension .mp3 and skip remaining files with extension .m4a. I also want to preserve the directory structure present in memory card.
In my hard drive I have a partition with 50 GB of free space. I have created a directory called copied.
In Linux we can create a small script which does the above but I don’t know shell scripting. At present I am engaged in some other work and I don’t have time to learn shell scripting.
That would be absolute nonsense to write a script for it, since it can be done with a simple oneliner:
cp -a /sdcard/music/*.mp3 /run/media/root/source/copied/
And once again: we’re not some kind of script factory, we’re support forums. Where all are volunteers doing this is their own spare time. You could have googled this easily and google would even have provided you with the syntax of the command. Please take this in consideration.
For the case of “find”, you could consider using ‘-iname’ in place of ‘-name’ to work around any Upper/Lower case issues.
Further for the case of “find”, please be aware that, the complete path name of the command to be executed by ‘-exec’ is preferred over the “usual”, path dependent, command characters.
Further for the case of “find”, please be aware that, the ‘-exec’ parameter {} often needs be enclosed in single quotes – ‘{}’ …
Rupesh, I have to agree with Knurpht, and add that your question itself is incredibly rude. YOU want to accomplish something, and tell us that you don’t have time to do it, then expect us to do it for you? Also, you have been playing this “I don’t know scripting/I am very new/I don’t have time” card for YEARS at this point, not only here but on other forums where it got you banned. A simple search here tells me you’ve been asking about scripts for 3 years; why, in all that time, have you been unable to learn the very basics? Bash tutorials are everywhere, and a simple loop is all that’s needed. A Google search for your user ID and “linux script” tells me that you’ve been asking for scripts for 7 yrs. at least.
Why, WHY can you not show efforts of your own, after so many years?
**Later:
**
Again it’s WE should save you many hours of time, which will take up OUR time. Instead of that, why can’t you learn how to script yourself after so many years? If you spent as much time learning scripting as you do with your hand out, asking people to write them for you, you’d have been a pro years ago. Bear in mind people on forums don’t care if you are ‘busy’, since we volunteer our time to help others.
I called him out once before, as you are doing now, and nothing has been done about that account. I have a sneaking suspicion that the account is used by multiple users.
Which is possibly OK for things specific to openSUSE but, I have my reservations with respect to things which are specific to UNIX® and/or Linux in general …
Meaning, there’re people on this planet who are earning their living by teaching general UNIX® and/or Linux knowledge «Bash, Awk, Sed, Vi, Grep, etc., etc. … ».
I was thinking more like an open computer in a classroom where their class has this single account.
It’s the only thing I can see to explain his continuous request for us to do his “homework”.
But in the end, yes, like we’re being used as teachers.
Though I understand your reasoning, please let’s not go assuming things etc, I’ll close the thread now, since the OP has had enough advice to solve their issue.