is there a way to change the date of bunch of files according the folder date?
Moderators: Hacker, petermad, Stefan2, white
is there a way to change the date of bunch of files according the folder date?
Hi
is there a way to change the date of bunch of files according the folder date?
I have many folders with mp3 , and some mp3 date were modified by some software
I would like to set the creation and the modified dates of these files to the folder (they are inside)
i know in tc , there is change attribute , but i need to do to a lot of different files that are inside different folders
thanks
is there a way to change the date of bunch of files according the folder date?
I have many folders with mp3 , and some mp3 date were modified by some software
I would like to set the creation and the modified dates of these files to the folder (they are inside)
i know in tc , there is change attribute , but i need to do to a lot of different files that are inside different folders
thanks
love Total Commander , best file manager ever made
Re: is there a way to change the date of bunch of files according the folder date?
For files in one tree
Branch view (Ctrl-B)
Select all files (Ctrl-A)
Files Change attributes
Branch view (Ctrl-B)
Select all files (Ctrl-A)
Files Change attributes
Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
Re: is there a way to change the date of bunch of files according the folder date?
HiHorst.Epp wrote: 2022-12-20, 08:33 UTC For files in one tree
Branch view (Ctrl-B)
Select all files (Ctrl-A)
Files Change attributes
i'm looking for a way to select a bunch of folders (30 or 40 folders ) and perform this action
can I do it ?
thanks
love Total Commander , best file manager ever made
Re: is there a way to change the date of bunch of files according the folder date?
Instead of Ctrl+B you can use Ctrl+Shift+B to open a branch view with only the selected folders.
But in the Change attributes dialog you would need to use a content pluging to find the date of the files' parent folder - and I don't know of such a plugin.
Apart from that - if your files are on an NTFS volume, the folder date does not stay untouched - Windows changes it, whenever files are added to the folder.
But in the Change attributes dialog you would need to use a content pluging to find the date of the files' parent folder - and I don't know of such a plugin.
Apart from that - if your files are on an NTFS volume, the folder date does not stay untouched - Windows changes it, whenever files are added to the folder.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: is there a way to change the date of bunch of files according the folder date?
hipetermad wrote: 2022-12-20, 12:19 UTC Instead of Ctrl+B you can use Ctrl+Shift+B to open a branch view with only the selected folders.
But in the Change attributes dialog you would need to use a content pluging to find the date of the files' parent folder - and I don't know of such a plugin.
Apart from that - if your files are on an NTFS volume, the folder date does not stay untouched - Windows changes it, whenever files are added to the folder.
yes but windows keep untochouted in NTFS the creation date
and use NirCmd and setfiletime to do the job , it does use variable
Code: Select all
Change the date/time of the specified filename (creation time and modified time) nircmd.exe setfiletime "c:\temp\myfile.txt" "24-06-2003 17:57:11" "22-11-2005 10:21:56"
thanks
love Total Commander , best file manager ever made
Re: is there a way to change the date of bunch of files according the folder date?
2giulia
It is easy enough to select the files and change the date to a date that you type in - see: https://madsenworld.dk/tcmd/changefiledates.png - the problem is that you want TC to automatically use the date of the folder which the files are located in - I don't see a solution for that.
If there was a plugin that provided the date of the folder it could have been use by clicking the [+] button (highlighted in blue).
It is easy enough to select the files and change the date to a date that you type in - see: https://madsenworld.dk/tcmd/changefiledates.png - the problem is that you want TC to automatically use the date of the folder which the files are located in - I don't see a solution for that.
If there was a plugin that provided the date of the folder it could have been use by clicking the [+] button (highlighted in blue).
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: is there a way to change the date of bunch of files according the folder date?
Here's a PowerShell script for that:
Save as "Set-Date-of-Parent.ps1" and put it on a button with adjusted path.
Then use Ctrl+B or Shift+Ctrl+B to select your files.
Button:
Script:
Remove the "-NoExit" after testing.
I use a similar script to restore folder dates after deleting files with something like this:
Save as "Set-Date-of-Parent.ps1" and put it on a button with adjusted path.
Then use Ctrl+B or Shift+Ctrl+B to select your files.
Button:
Code: Select all
TOTALCMD#BAR#DATA
powershell.exe
-NoExit -ExecutionPolicy remotesigned -Command "&{&'C:\PathTo\Set-Date-of-Parent.ps1' -FileList '%L'}"
powershell.exe
0
-1
Code: Select all
Param(
[Parameter(Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[string]$FileList
)
$contentFileList = Get-Content -LiteralPath $FileList
$answer = Read-Host -Prompt "Change date for $($contentFileList.Length) files?"
if (("y","Y","j","J") -contains $answer)
{
Write-Output "Changing dates"
foreach ($filePath in $contentFileList)
{
#Check if path exists and is a file
if (Test-Path -LiteralPath $filePath -PathType Leaf)
{
Write-Output $filePath
$fileItem = Get-Item -LiteralPath $filePath
#Set the Dates of Parent Folder
$fileItem.CreationTime = $fileItem.Directory.CreationTime
$fileItem.LastAccessTime = $fileItem.Directory.LastAccessTime
$fileItem.LastWriteTime = $fileItem.Directory.LastWriteTime
}
}
}
I use a similar script to restore folder dates after deleting files with something like this:
Code: Select all
$oldFolderDate = $fileItem.Directory.LastWriteTime
$fileItem.Delete()
$fileItem.Directory.LastWriteTime = $oldFolderDate
Re: is there a way to change the date of bunch of files according the folder date?
HiZoSTeR wrote: 2022-12-21, 14:18 UTC Here's a PowerShell script for that:
Save as "Set-Date-of-Parent.ps1" and put it on a button with adjusted path.
Then use Ctrl+B or Shift+Ctrl+B to select your files.
Button:Script:Code: Select all
TOTALCMD#BAR#DATA powershell.exe -NoExit -ExecutionPolicy remotesigned -Command "&{&'C:\PathTo\Set-Date-of-Parent.ps1' -FileList '%L'}" powershell.exe 0 -1
Remove the "-NoExit" after testing.Code: Select all
Param( [Parameter(Mandatory=$True)] [ValidateNotNullOrEmpty()] [string]$FileList ) $contentFileList = Get-Content -LiteralPath $FileList $answer = Read-Host -Prompt "Change date for $($contentFileList.Length) files?" if (("y","Y","j","J") -contains $answer) { Write-Output "Changing dates" foreach ($filePath in $contentFileList) { #Check if path exists and is a file if (Test-Path -LiteralPath $filePath -PathType Leaf) { Write-Output $filePath $fileItem = Get-Item -LiteralPath $filePath #Set the Dates of Parent Folder $fileItem.CreationTime = $fileItem.Directory.CreationTime $fileItem.LastAccessTime = $fileItem.Directory.LastAccessTime $fileItem.LastWriteTime = $fileItem.Directory.LastWriteTime } } }
I use a similar script to restore folder dates after deleting files with something like this:
Code: Select all
$oldFolderDate = $fileItem.Directory.LastWriteTime $fileItem.Delete() $fileItem.Directory.LastWriteTime = $oldFolderDate
I will read the folder created time and change the created and modified date of the files inside ,right?
great script , doesn't work under w7 , don't it?
thanks , I will try it
love Total Commander , best file manager ever made
Re: is there a way to change the date of bunch of files according the folder date?
Yes, it will read the file's parent-folder's dates and set them to the file. It should also work with Windows 7 SP1 from what I've read.giulia wrote: 2022-12-21, 15:03 UTC Hi
I will read the folder created time and change the created and modified date of the files inside ,right?
great script , doesn't work under w7 , don't it?
thanks , I will try it
Re: is there a way to change the date of bunch of files according the folder date?
Hi @ZoSTeRZoSTeR wrote: 2022-12-21, 15:12 UTCYes, it will read the file's parent-folder's dates and set them to the file. It should also work with Windows 7 SP1 from what I've read.giulia wrote: 2022-12-21, 15:03 UTC Hi
I will read the folder created time and change the created and modified date of the files inside ,right?
great script , doesn't work under w7 , don't it?
thanks , I will try it
I have to save in a bat file ,right?
and this script does change the modified date to the creation date of a folder?
Code: Select all
$oldFolderDate = $fileItem.Directory.LastWriteTime
$fileItem.Delete()
$fileItem.Directory.LastWriteTime = $oldFolderDate
love Total Commander , best file manager ever made
Re: is there a way to change the date of bunch of files according the folder date?
There is no need for any bat file !
As said, store the script, add the provided button
and change the path in this button to the place where you stored the script.
As said, store the script, add the provided button
and change the path in this button to the place where you stored the script.
Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
Re: is there a way to change the date of bunch of files according the folder date?
hiHorst.Epp wrote: 2022-12-21, 17:36 UTC There is no need for any bat file !
As said, store the script, add the provided button
and change the path in this button to the place where you stored the script.
i have to create a file with the extension ps1 and the file have to be Set-Date-of-Parent.ps1
and there is that it's a powershell , w7 has no powershell if i'm remember right
thanks
love Total Commander , best file manager ever made
Re: is there a way to change the date of bunch of files according the folder date?
See Win7 start menu und search for Powershell
Or press Win+R together and type in powershell
If not found, google for "Microsoft Windows Powershell for Windows 7" and just install it
(may also need newer .NET Framework version, but can be read there)
If you need more help, just ask.
Edit:
Windows PowerShell comes installed by default in every Windows, starting with Windows 7 SP1
https://learn.microsoft.com/en-us/skypeforbusiness/set-up-your-computer-for-windows-powershell/download-and-install-windows-powershell-5-1
https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/install/installing-windows-powershell?view=powershell-7.3
Re: is there a way to change the date of bunch of files according the folder date?
hi ZoSTeRZoSTeR wrote: 2022-12-21, 15:12 UTCYes, it will read the file's parent-folder's dates and set them to the file. It should also work with Windows 7 SP1 from what I've read.giulia wrote: 2022-12-21, 15:03 UTC Hi
I will read the folder created time and change the created and modified date of the files inside ,right?
great script , doesn't work under w7 , don't it?
thanks , I will try it
it works!
So i can select many different folders once with different creation date and let the script do the job?
thanks ZoSTeR ,take care
I had to change the button script path , i tried to change to %COMMANDER_PATH%\ but it doesn't work , so i have added the total commander full patch and copied inside
so now i can remove the -NoExit and in the script ?
Code: Select all
$answer = Read-Host -Prompt "Change date for $($contentFileList.Length) files?"
if (("y","Y","j","J") -contains $answer)
Code: Select all
TOTALCMD#BAR#DATA
powershell.exe
-NoExit -ExecutionPolicy remotesigned -Command "&{&'%COMMANDER_PATH%\Set-Date-of-Parent.ps1' -FileList '%L'}"
powershell.exe
-1
hiStefan2 wrote: 2022-12-21, 18:36 UTC
See Win7 start menu und search for Powershell
Or press Win+R together and type in powershell
If not found, google for "Microsoft Windows Powershell for Windows 7" and just install it
(may also need newer .NET Framework version, but can be read there)
If you need more help, just ask.
Edit:
Windows PowerShell comes installed by default in every Windows, starting with Windows 7 SP1
https://learn.microsoft.com/en-us/skypeforbusiness/set-up-your-computer-for-windows-powershell/download-and-install-windows-powershell-5-1
https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/install/installing-windows-powershell?view=powershell-7.3
yes , it woks with w7
thanks
love Total Commander , best file manager ever made
Re: is there a way to change the date of bunch of files according the folder date?
Here's the minimized version without confirmation using the Commander_Path environment variable:
Button:
Script:
Button:
Code: Select all
TOTALCMD#BAR#DATA
powershell.exe
-ExecutionPolicy remotesigned -Command "&{&"""$env:COMMANDER_PATH\Tools\PowerShell\Set-Date-of-Parent.ps1""" -FileList '%L'}"
powershell.exe
Set Date of Parent
1
-1
Code: Select all
Param(
[Parameter(Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[string]$FileList
)
$contentFileList = Get-Content -LiteralPath $FileList
foreach ($filePath in $contentFileList)
{
if (Test-Path -LiteralPath $filePath -PathType Leaf)
{
$fileItem = Get-Item -LiteralPath $filePath
$fileItem.CreationTime = $fileItem.Directory.CreationTime
$fileItem.LastWriteTime = $fileItem.Directory.LastWriteTime
}
}