我很难将某些文件的创建日期复制到其他文件。
我已经将一些MXF文件转换为MOV,但遗憾的是新的MOV文件没有相同的创建日期。
信息:文件肯定是* MXF和* mov。
现在我浏览了类似的问题并找到了不同的答案:
#!/bin/bash
for f in *.MXF; do
touch -r "$f" "${f%MXF}mov"
done
不幸的是,这似乎不会编辑创建日期,而只会修改修改日期。有没有办法复制创建日期呢?
修改 我也发现了这个代码,它似乎正在运行 - 但仍然没有创建日期。
set folder1 to POSIX file "/POSIX/path/to/MFX/folder"
set folder2 to POSIX file "/POSIX/path/to/MOV/folder"
tell application "Finder"
set folder1 to folder folder1
set folder2 to folder folder2
set N to (count folder1)
if not (count folder2) = N then return
set creationDates to creation date of files of folder1
set modificationDates to modification date of files of folder1
repeat with k from 1 to N
my changeDates(file k of folder2, item k of creationDates, item k of modificationDates)
end repeat
end tell
on changeDates(theFile, theCreationDate, theModificationDate)
tell application "Finder"
set modification date of theFile to theCreationDate
set modification date of theFile to theModificationDate
end tell
end changeDates
但我希望它改变创建和修改日期。不幸的是,当我将set modification date of theFile to theCreationDate
更改为set creation date of theFile to theCreationDate
我如何复制创建日期?