Hi
is there a way to change the files creation and modified date using their folder creation date?
a classic example is ,a folder and a bunch of mp3 inside ,some of them has the modified date changed by a program , would like to change their created and modified date using the createdion date folder (not modified because windows change it )
and would really cool ,if could be done with several folder , like 10 folders ,each with files inside
thanks
take care
can xyplorer change the date of the filder using the folder date?
-
giuliastar
- Posts: 365
- Joined: 14 Sep 2013 07:22
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: can xyplorer change the date of the filder using the folder date?
Sure, script it^^
One of my scripts helped you out? Please donate via Paypal
-
giuliastar
- Posts: 365
- Joined: 14 Sep 2013 07:22
-
Horst
- Posts: 1389
- Joined: 24 Jan 2021 12:27
- Location: Germany
Re: can xyplorer change the date of the filder using the folder date?
This powershell script does it if you give it a list of files as argument.
So your scripting effort in XY will be small.
So your scripting effort in XY will be small.
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
}
}
}
Windows 11 Home, Version 25H2 (OS Build 26200.8875)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1416b (x64), Everything Toolbar 2.4.1, Listary Pro 7.0.0.5 beta
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1416b (x64), Everything Toolbar 2.4.1, Listary Pro 7.0.0.5 beta
-
giuliastar
- Posts: 365
- Joined: 14 Sep 2013 07:22
Re: can xyplorer change the date of the filder using the folder date?
hi @HorstHorst wrote: ↑21 Dec 2022 18:00 This powershell script does it if you give it a list of files as argument.
So your scripting effort in XY will be small.
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 } } }
should i create a button or can i save to a file ? May i know which extension should i use if i want a file?
thanks a lot Horst
-
Horst
- Posts: 1389
- Joined: 24 Jan 2021 12:27
- Location: Germany
Re: can xyplorer change the date of the filder using the folder date?
For example store the script under the name Set-Date-of-Parent.ps1
Then try to read the help or examples in the script forum how to get a list of files into a file.
This file would be the parameter for a button which invokes the script.
Example without much scripting, create a paper folder with your files and use this as parameter.
Then try to read the help or examples in the script forum how to get a list of files into a file.
This file would be the parameter for a button which invokes the script.
Example without much scripting, create a paper folder with your files and use this as parameter.
Windows 11 Home, Version 25H2 (OS Build 26200.8875)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1416b (x64), Everything Toolbar 2.4.1, Listary Pro 7.0.0.5 beta
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1416b (x64), Everything Toolbar 2.4.1, Listary Pro 7.0.0.5 beta
-
admin
- Site Admin
- Posts: 66366
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: can xyplorer change the date of the filder using the folder date?
This will change all 3 dates of the selected-and-focused list item to the dates of its parent folder:
You can run it through the address bar. Is that what you wanted?
Code: Select all
$item = <curitem>; $parent = gpc($item, "path"); timestamp , $parent, $item;FAQ | XY News RSS | XY X
XYplorer Beta Club