Rename files on Android phone using script

I have an Android phone and I continue to upload some media files that I would not want to appear in the gallery. Don't think I'm absurd here. To accomplish this task, I wrote a small and lightweight script. Here it is.

echo "Below files will be hidden." for fName in `ls /storage/extSdCard/Download/*.mp4` do echo $fName mv -f $fName `basename $fName .mp4`.bak done 

When I execute this script using the Explorer application of the Script executor application with the root user, I get an error message as shown below.

 mv: can't create 'abc.mp4': Read-only file system 

I assume that the root user has a free run on unix / linux based systems. Can anyone direct me to this?

+6
source share
2 answers

The folder abc.mp4 should have placed is probably accessible only to all users. Use the ls -l in the parent folder to verify.

If you want abc.mp4 in a folder, use chmod to change the permission of the folder first. For example, if a folder has the name folder :

 chmod +wx folder 

w for permission to write, x for permission to execute. After changing the permission, you can restart the script without any problems.

0
source

Android has a built-in option to β€œhide” multimedia files, such as .MP3 and .JPG, from the gallery in Media Applications.

All you have to do is create an empty file named .nomedia and put it in the same directory as the media files that you want to "hide".

Thus, depending on your requirements, it may be easier to modify your script to simply move the files to another directory and place the .nomedia file in it.

0
source

Source: https://habr.com/ru/post/951479/


All Articles