Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
i want to edit a bunch of .MOD videos to .mpg

however i want to keep the same date as the original files
and everytime i modify a file's name or extension, the date changed to the moment i made the modifications

so for example i have those files of 2008 in .MOD format, when i click and change them to .mp4 or .mpg , they become 2022 (today's date

is there a way to change that behavior ?
 

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
Im trying to change the name of the file , and then import the videos to Google photos

However Google photos doesnā€™t read from the metadata ( at least it doesnā€™t read the date) but instead looks for Ā« last modified Ā» , which with finder is TODAY even for a file made in 2008


So Iā€™m looking for a way to simply change the NAME of the file without touching the date

Iā€™d try third party apps , Iā€™m ok with that
 

chown33

Moderator
Staff member
Aug 9, 2009
10,761
8,463
A sea of green
What format is the disk these files are on? Is it APFS, HFS+, ExFAT, or something else?

As far as I know, changing the name of a file (including its extension) on HFS+ or ExFAT has no effect on the modification-date of the file itself. It does change the mod-date of the folder it's in.

I don't know if this holds true for APFS as I have nothing here using APFS, so can you please double-check by posting before and after screenshots of the Get Info box, changing just the file-name of a ".txt" file?

If APFS does have this behavior, you might be able to avoid it by copying files to a thumb drive (or external drive) formatted as HFS+ or ExFAT, changing the names there, then copying them back. Or edit them on the external drive.

Info:
 

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
What format is the disk these files are on? Is it APFS, HFS+, ExFAT, or something else?

As far as I know, changing the name of a file (including its extension) on HFS+ or ExFAT has no effect on the modification-date of the file itself. It does change the mod-date of the folder it's in.

I don't know if this holds true for APFS as I have nothing here using APFS, so can you please double-check by posting before and after screenshots of the Get Info box, changing just the file-name of a ".txt" file?

If APFS does have this behavior, you might be able to avoid it by copying files to a thumb drive (or external drive) formatted as HFS+ or ExFAT, changing the names there, then copying them back. Or edit them on the external drive.

Info:
good question . it is exfat , but i make the modification AFTER i transfer the file to my sd card...which is exfat as well

and unfortunately it does make a difference on the file itself ...unless im doing someething wrong
 

bogdanw

macrumors 603
Mar 10, 2009
5,707
2,746
Try with a file from Terminal
-to visualize the time & date atributes
Code:
mdls /path/to/file.MOD
- to change the name and extension
Code:
mv /path/to/file.MOD /path/to/newfile.mpg
- to see if anything else changed
Code:
mdls /path/to/newfile.mpg

If it works as you want it, you can change the extension for all the files in the folder
Code:
for file in *.MOD; do mv $file "${file%.*}.mpg"; done

Edited to correct typing error.
 
Last edited:

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
What do you mean by "edit"? Rename in Finder or reformatting with an app?


Which date?

If I use Finder to change the file extension, there is no change to modified date (or other dates).
renaming in finder,yes . the file's date changes , and is recognized as such by google photos

for example all of my 2008 videos are now in 2022 in google photos , which is a mess
 

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
a
Try with a file from Terminal
-to visualize the time & date atributes
Code:
mdls /path/to/file.MOD
- to change the name and extension
Code:
mv /path/to/file.MOD /path/to/newfile.mpg
- to see if anything else changed
Code:
mdls /path/to/newfile.mpg

If it works as you want it, you can change the extension for all the files in the folder
Code:
for file in *.mts; do mv $file "${file%.*}.mpg"; done
assumingi it works, i just need to enter that in terminal ? "for file in *.mts; do mv $file "${file%.*}.mpg"; done"
 

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
What format is the disk these files are on? Is it APFS, HFS+, ExFAT, or something else?

As far as I know, changing the name of a file (including its extension) on HFS+ or ExFAT has no effect on the modification-date of the file itself. It does change the mod-date of the folder it's in.

I don't know if this holds true for APFS as I have nothing here using APFS, so can you please double-check by posting before and after screenshots of the Get Info box, changing just the file-name of a ".txt" file?

If APFS does have this behavior, you might be able to avoid it by copying files to a thumb drive (or external drive) formatted as HFS+ or ExFAT, changing the names there, then copying them back. Or edit them on the external drive.

Info:
i've just tried on exfat and it still shows the modified date as today , which is what google photos uses to pull metadat and put it in the appropriate year

1672528531382.png
 

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
Try with a file from Terminal
-to visualize the time & date atributes
Code:
mdls /path/to/file.MOD
- to change the name and extension
Code:
mv /path/to/file.MOD /path/to/newfile.mpg
- to see if anything else changed
Code:
mdls /path/to/newfile.mpg

If it works as you want it, you can change the extension for all the files in the folder
Code:
for file in *.mts; do mv $file "${file%.*}.mpg"; done
thanks .

so it looks like doing so there is no change to the date indeed, however when i copy it to my external device (be it my android phone, for which i use google photos, or my SD card, it changes the date TO THE MOMENT of the copy )

for example i tried you cmd you told me to use and both files weren't different , both being 2011.

but when i added them to either the sd card or android internal memory, the file date changed to 2023 ! (happy new year btw )

so i gotta find a way to transfer the files without changing the date ...i'm lost tbh
 

Grumpus

macrumors regular
Jan 17, 2021
240
158
If you're ok with using the terminal, you could use "cp -p" to copy (and rename) a file, preserving the modify time. The following command would copy somefile.MOD from the current directory to an external drive, renaming it (by changing the extension) and preserving the modify time:
Code:
$ cp -p somefile.MOD /Volumes/Untitled/somefile.mpg

You can use the stat command with the -x flag to check the time-related metadata:
Code:
$ stat -x somefile.MOD /Volumes/Untitled/somefile.mpg
will show the time metadata for both the input and output files. The modify times should be identical.
 

gilby101

macrumors 68030
Mar 17, 2010
2,521
1,359
Tasmania
so it looks like doing so there is no change to the date indeed, however when i copy it to my external device (be it my android phone, for which i use google photos, or my SD card, it changes the date TO THE MOMENT of the copy )
for example i tried you cmd you told me to use and both files weren't different , both being 2011.
but when i added them to either the sd card or android internal memory, the file date changed to 2023 ! (happy new year btw )
Progress! So not a rename causing the problem. Rather a copy to another file system.

My understanding is that FAT does support both create and modify dates though not with the same granularity as APFS or HFS+ (as used by macOS). The precise format (and how/where formatted) may be important.

I don't know about android phones.

Edit: Your trouble is with FAT format. I have a FAT formatted flash drive.

Do two tests with source file on APFS volume (default for macOS).

Test 1:
Rename source file: Create and modify dates unchanged.
Copy renamed file to FAT disk: Create and modify dates unchanged.

Test 2:
Copy source file to FAT disk: Create and modify dates unchanged.
Rename file on FAT disk: Create date unchanged. Modify date becomes now.

My solution: Do your renaming first on the macOS disk (APFS or HFS+) and then copy to FAT.

I have to ask: why all the copying to FAT disk rather than sending directly to Google Photos?
 
Last edited:

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
If you're ok with using the terminal, you could use "cp -p" to copy (and rename) a file, preserving the modify time. The following command would copy somefile.MOD from the current directory to an external drive, renaming it (by changing the extension) and preserving the modify time:
Code:
$ cp -p somefile.MOD /Volumes/Untitled/somefile.mpg

You can use the stat command with the -x flag to check the time-related metadata:
Code:
$ stat -x somefile.MOD /Volumes/Untitled/somefile.mpg
will show the time metadata for both the input and output files. The modify times should be identical.
thanks unfortunately i can't do this since android isnt' supported natively
 

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
I thought you said you're copying to an exfat-formatted SD card.
yeah i thought about that after i wrote my comment

i mean i've tried both methods : using the phone storage directly, or by plugging a sd card in

you're right i could try what you advised later

im very tired right now

thanks for your help
 

Love-hate šŸ relationship

macrumors 68030
Original poster
Sep 19, 2021
2,977
3,112
Progress! So not a rename causing the problem. Rather a copy to another file system.

My understanding is that FAT does support both create and modify dates though not with the same granularity as APFS or HFS+ (as used by macOS). The precise format (and how/where formatted) may be important.

I don't know about android phones.

Edit: Your trouble is with FAT format. I have a FAT formatted flash drive.

Do two tests with source file on APFS volume (default for macOS).

Test 1:
Rename source file: Create and modify dates unchanged.
Copy renamed file to FAT disk: Create and modify dates unchanged.

Test 2:
Copy source file to FAT disk: Create and modify dates unchanged.
Rename file on FAT disk: Create date unchanged. Modify date becomes now.

My solution: Do your renaming first on the macOS disk (APFS or HFS+) and then copy to FAT.

I have to ask: why all the copying to FAT disk rather than sending directly to Google Photos?
ill try that later

because i have a device that has unlimited backup (all pixels before the 5a ) so sending the pictures from my iphone/mac/drive to the android device allows me to enjoy unlimited free backup which is kinda tricky but handy lol
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.