Copying files training retaining the time stamp

mmjoshi

Member
I want to copy a file retaining the time stamp. So instead of using the Copy command I am using the flowing shell script

cp --preserve=timestamps /storage/emulated/0/TestA.txt /storage/emulated/0/TestB.txt

I have also checked Use the helper App and selected the Non Rooted option. I have the latest 1.7 version of the Helper App installed.

This does not work. Am I doing something wrong?

I am not familiar with Linux commands. How do I specicy folder/file names with spaces in their names?
 

mmjoshi

Member
I want to copy a file retaining the time stamp. So instead of using the Copy command I am using the flowing shell script

cp --preserve=timestamps /storage/emulated/0/TestA.txt /storage/emulated/0/TestB.txt

I have also checked Use the helper App and selected the Non Rooted option. I have the latest 1.7 version of the Helper App installed.

This does not work. Am I doing something wrong?

I am not familiar with Linux commands. How do I specicy folder/file names with spaces in their names?
I could figure out how to copy files using shellscript. However, I can copy files only on the internal storage. How do I copy files from the internal storage to the external SD card? How does Android refer to the SD card? I have tried extSDcard, externalstoage, etc. Nothing works.

I am on a Nokia 6.1 running Android 10.
 

Qarboz

Well-known member
I could figure out how to copy files using shellscript. However, I can copy files only on the internal storage. How do I copy files from the internal storage to the external SD card? How does Android refer to the SD card? I have tried extSDcard, externalstoage, etc. Nothing works.

I am on a Nokia 6.1 running Android 10.
I'm afraid it's not possible without root
 

Dimlos

Well-known member
I used the SDcard path as shown in the Filer, and although Permission denied in the shell script,
I was able to copy the file by using the ADB Shell [Tasker Plugin].

The syntax is the same as the shell script, and by using ADB Shell [Tasker Plugin], it is possible to run non-rooted.
 

Attachments

  • SDcard_Path.jpg
    SDcard_Path.jpg
    288.8 KB · Views: 14
  • FileCopyMacro.jpg
    FileCopyMacro.jpg
    614.3 KB · Views: 14

mmjoshi

Member
I used the SDcard path as shown in the Filer, and although Permission denied in the shell script,
I was able to copy the file by using the ADB Shell [Tasker Plugin].

The syntax is the same as the shell script, and by using ADB Shell [Tasker Plugin], it is possible to run non-rooted.
I do not use Tasker. However, I tried a shellscript as shown in the attached image. Neither do I get an error nor is the file copied. BTW, I am still on Android 10. So I guess the Google restrictions mentioned by @Qarboz are not applicable.

I am using the path for my external storage as shown by the Amaze file manager. In any case should I not get an error?
 

Attachments

  • Screenshot_20221007-122236.png
    Screenshot_20221007-122236.png
    153.5 KB · Views: 9

Dimlos

Well-known member
I am also testing on an Android 10 device, and I think it is not that there is no error, but that you have not set up to save the output.
You should create a string variable in the Save output in string variable in the Shell Scrirt dialog and set it up.
Tasker Plugin and MacroDroid are compatible, so you can use ADB Shell [Tasker Plugin] with MacroDroid.
 

Attachments

  • Save_output.jpg
    Save_output.jpg
    268.9 KB · Views: 7
  • ADBPlugin.jpg
    ADBPlugin.jpg
    250.3 KB · Views: 8

mmjoshi

Member
I am also testing on an Android 10 device, and I think it is not that there is no error, but that you have not set up to save the output.
You should create a string variable in the Save output in string variable in the Shell Scrirt dialog and set it up.
Tasker Plugin and MacroDroid are compatible, so you can use ADB Shell [Tasker Plugin] with MacroDroid.
@Dimlos Thanks for pointing this out. I did get the dreaded "Permission denied" error!

How does the Tasker plugin work? Just install it from the Play Store? Is there any set up required?
 

Dimlos

Well-known member
When using ADB Shell [Tasker Plugin], you must first connect to the PC and enter the adb command adb tcpip 5555,
this command is valid until the device is rebooted.
 

mmjoshi

Member
When using ADB Shell [Tasker Plugin], you must first connect to the PC and enter the adb command adb tcpip 5555,
this command is valid until the device is rebooted.
Thanks. Wish there was something within Macrodroid which could do this. Hate to buy another app.
 

mmjoshi

Member
Thanks. Will install tomorrow and test.
Works with plugin only, no need to purchase Tasker.
This is what I have done. Still get an error. Do I need to do anything in the ADB Helper plugin. I have ran the adb tcpip 5555 by connecting the mobile to my PC. The command resulted in "restarting in TCP mode port: 5555" message.
 

Attachments

  • Screenshot_20221008-125933.png
    Screenshot_20221008-125933.png
    170.4 KB · Views: 7
  • Screenshot_20221008-125951.png
    Screenshot_20221008-125951.png
    191.6 KB · Views: 6
Top