Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

On Ubuntu, how do you get all timestamps with file backup?

JosiahMaybe

Gold Coder
I have an Ubuntu computer and would like a files backup with all timestamps preserved. Can it be done? This is not a system image, trying for readable on any computer. I have like my own timestamp recording program so I am covered for now but rsync does not have created at and cp just copies last modified. If this can be done then good but can it? I am sure like my program accurately records timestamps so not needed but still. Any solution where I can get like my files back and their timestamps on Windows and Ubuntu would be good. If you know a way please tell me. X E.
 
I have an Ubuntu computer and would like a files backup with all timestamps preserved. Can it be done? This is not a system image, trying for readable on any computer. I have like my own timestamp recording program so I am covered for now but rsync does not have created at and cp just copies last modified. If this can be done then good but can it? I am sure like my program accurately records timestamps so not needed but still. Any solution where I can get like my files back and their timestamps on Windows and Ubuntu would be good. If you know a way please tell me. X E.
Not sure about that, but I did find you this lovely gem... may be worth checking out
 
It looks like it requires Perl and it is for servers. I may just make like my own Ruby script for it unless someone has a better idea. I may need sudo ruby though so have to install Ruby again as root. Like my backup is like a perfect test ground for restoring stuff. Thanks but unsure if that helps. Good I at least have all timestamps stored as something though. I expect some way to decode that timestamps file in future times. X E.
 
I just discovered that Ruby does not support setting creation time but Python does but I would rather not use that. Do you know of any other programming languages I could use on command line in Ubuntu and use to set created at times? X E. Update: Looks like I am learning Bash maybe. Know any good material to make a file I could run for start and end with this? Know where to learn Bash? X E.
 
Last edited:
I just discovered that Ruby does not support setting creation time but Python does but I would rather not use that. Do you know of any other programming languages I could use on command line in Ubuntu and use to set created at times? X E. Update: Looks like I am learning Bash maybe. Know any good material to make a file I could run for start and end with this? Know where to learn Bash? X E.
why not use Python?
 
I tried zzzcode.ai and got this.
#!/bin/bash

# Prompt the user to enter the source and destination paths
read -p "Enter the source path: " source_path
read -p "Enter the destination path: " destination_path

# Check if the USB drive is already mounted
if grep -qs "$destination_path" /proc/mounts; then
echo "USB drive is already mounted. Skipping recursive copy."
else
# Copy the properties of files to the USB drive
find "$source_path" -type f -exec stat -c "%n %w %x %y" {} + | awk -v dest="$destination_path" '{print "touch -d \""$2"\" -m \""$3"\" -a \""$4"\" \""dest"/"$1"\""}' | bash
fi

#X E.

# FREE AI Code Generator: Generate Code Online in Any Language

If anyone wants to review it before I try it feel free. It is from zzzcode.ai so it is free now. That is assuming I can get data from like my Ubuntu computer to like my USB. Last time I tried rsync it was recursive on like my USB and overloaded memory so I lost it. I guess some exclude option is needed. X E.
 
I tried zzzcode.ai and got this.
#!/bin/bash

# Prompt the user to enter the source and destination paths
read -p "Enter the source path: " source_path
read -p "Enter the destination path: " destination_path

# Check if the USB drive is already mounted
if grep -qs "$destination_path" /proc/mounts; then
echo "USB drive is already mounted. Skipping recursive copy."
else
# Copy the properties of files to the USB drive
find "$source_path" -type f -exec stat -c "%n %w %x %y" {} + | awk -v dest="$destination_path" '{print "touch -d \""$2"\" -m \""$3"\" -a \""$4"\" \""dest"/"$1"\""}' | bash
fi

#X E.

# FREE AI Code Generator: Generate Code Online in Any Language

If anyone wants to review it before I try it feel free. It is from zzzcode.ai so it is free now. That is assuming I can get data from like my Ubuntu computer to like my USB. X E.
Yeah... you'll get an error
 
You'll get an error if touch isn't installed... and your if statement needs brackets of you're checking for boolean...
I suggest learning the basics of BASH before you do this
 
I was just trying for a simple way, and Bash seems to be how to try, I can sudo it. Still unsure how to do this though and thanks for that error thing. X E.
 
AI like the chatGPT are great resources, but they are starting to make people extremely lazy, and not wanting to learn
 
I just discovered that Ruby does not support setting creation time but Python does but I would rather not use that. Do you know of any other programming languages I could use on command line in Ubuntu and use to set created at times? X E. Update: Looks like I am learning Bash maybe. Know any good material to make a file I could run for start and end with this? Know where to learn Bash? X E.
Then why state "looks like I am learning Bash" if you already know the basics? I can definitely send you some tutorials that helped me out when I was first learning Bash.
 
I just want a thing to copy all timestamps from / to a USB and all in / to a USB, basically a clone. I think this can be done but still thought I would ask a like expert and since it is easier to ask AI may as well. Anyway, thanks, good to have a human expert on this. X E.
 
It was looks like I am learning Bash earlier today, I learned basics, now at basics of Bash from nothing when I asked that question and like I said very basic. X E.
 
Feel free to send me your resources. X E.

Beginner's Guide to the Bash Terminal

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://www.youtube.com/watch?v=oxuRxtrO2Ag


Bash scripting full course
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://www.youtube.com/watch?v=e7BufAVwDiM
 
I tried zzzcode.ai and got this.
#!/bin/bash

# Prompt the user to enter the source and destination paths
read -p "Enter the source path: " source_path
read -p "Enter the destination path: " destination_path

# Check if the USB drive is already mounted
if grep -qs "$destination_path" /proc/mounts; then
echo "USB drive is already mounted. Skipping recursive copy."
else
# Copy the properties of files to the USB drive
find "$source_path" -type f -exec stat -c "%n %w %x %y" {} + | awk -v dest="$destination_path" '{print "touch -d \""$2"\" -m \""$3"\" -a \""$4"\" \""dest"/"$1"\""}' | bash
fi

#X E.

# FREE AI Code Generator: Generate Code Online in Any Language

If anyone wants to review it before I try it feel free. It is from zzzcode.ai so it is free now. That is assuming I can get data from like my Ubuntu computer to like my USB. Last time I tried rsync it was recursive on like my USB and overloaded memory so I lost it. I guess some exclude option is needed. X E.
Also, might wanna remove that "+" before the pipe to awk... might cause an error
 

Beginner's Guide to the Bash Terminal

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://www.youtube.com/watch?v=oxuRxtrO2Ag


Bash scripting full course
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://www.youtube.com/watch?v=e7BufAVwDiM

Here's some documentation if you prefer that
 
Okay, thanks, and if anyone has a backup solution like this so I do not need to make like my own feel free to let me know. Like my preferred way would be write a file with all properties to system precision, a writer for USB that sets properties from that file to its system precision, and a writer for computer that sets properties from that file. That way I can have this work on any computer and have all like my properties. X E.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom