How to change the creation date of (a/several) text file and then keep it when copied to another computer
I have several text files and I want to change the creation date of these files. I am running on several problems so I would appreciate advice for my case.
First I found this solution to change the creation date of one file. It involves running powershell (windows 10) with
(Get-Item test2.txt).creationtime=$(Get-Date "1/2/2016 12
:34 am")
It works. So then I have two issues. First, how to do this to a thousand files? It has to be automated or it would take too much time.
The second issue though is much more important.
Once I change the creation date of this file, if I copy this to another location, the copied file had its creation date reverted to today. To make matters worst, I have to copy these 10000 files (with their creation dates changed) to a windows 7 system and had these files with these old creation times.
But if they are going to revert to today and I won't have powershell there, how can I resolve my problem?
windows-7 powershell
add a comment |
I have several text files and I want to change the creation date of these files. I am running on several problems so I would appreciate advice for my case.
First I found this solution to change the creation date of one file. It involves running powershell (windows 10) with
(Get-Item test2.txt).creationtime=$(Get-Date "1/2/2016 12
:34 am")
It works. So then I have two issues. First, how to do this to a thousand files? It has to be automated or it would take too much time.
The second issue though is much more important.
Once I change the creation date of this file, if I copy this to another location, the copied file had its creation date reverted to today. To make matters worst, I have to copy these 10000 files (with their creation dates changed) to a windows 7 system and had these files with these old creation times.
But if they are going to revert to today and I won't have powershell there, how can I resolve my problem?
windows-7 powershell
add a comment |
I have several text files and I want to change the creation date of these files. I am running on several problems so I would appreciate advice for my case.
First I found this solution to change the creation date of one file. It involves running powershell (windows 10) with
(Get-Item test2.txt).creationtime=$(Get-Date "1/2/2016 12
:34 am")
It works. So then I have two issues. First, how to do this to a thousand files? It has to be automated or it would take too much time.
The second issue though is much more important.
Once I change the creation date of this file, if I copy this to another location, the copied file had its creation date reverted to today. To make matters worst, I have to copy these 10000 files (with their creation dates changed) to a windows 7 system and had these files with these old creation times.
But if they are going to revert to today and I won't have powershell there, how can I resolve my problem?
windows-7 powershell
I have several text files and I want to change the creation date of these files. I am running on several problems so I would appreciate advice for my case.
First I found this solution to change the creation date of one file. It involves running powershell (windows 10) with
(Get-Item test2.txt).creationtime=$(Get-Date "1/2/2016 12
:34 am")
It works. So then I have two issues. First, how to do this to a thousand files? It has to be automated or it would take too much time.
The second issue though is much more important.
Once I change the creation date of this file, if I copy this to another location, the copied file had its creation date reverted to today. To make matters worst, I have to copy these 10000 files (with their creation dates changed) to a windows 7 system and had these files with these old creation times.
But if they are going to revert to today and I won't have powershell there, how can I resolve my problem?
windows-7 powershell
windows-7 powershell
asked Jan 17 at 1:35
KansaiRobotKansaiRobot
14919
14919
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
All the answers you are after is in the PowerShell help files.
# Get a list of all functions
Get-Command -CommandType Function |
Out-GridView -PassThru -Title 'Available functions'
# Get a list of all commandlets
Get-Command -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available cmdlets'
# Get a list of all functions for the specified name
Get-Command -Name '*ADGroup*' -CommandType Function |
Out-GridView -PassThru -Title 'Available named functions'
# Get a list of all commandlets for the specified name
Get-Command -Name '*ADGroup**' -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available named cmdlet'
# get function / cmdlet details
(Get-Command -Name Get-ChildItem).Parameters
Get-help -Name Get-ChildItem -Examples
Get-help -Name Get-ChildItem -Full
Get-help -Name Get-ChildItem -Online
(Get-Command -Name ForEach).Parameters
Get-help -Name ForEach -Examples
Get-help -Name ForEach -Full
Get-help -Name ForEach -Online
(Get-Command -Name Copy-Item).Parameters
Get-help -Name Copy-Item -Examples
Get-help -Name Copy-Item -Full
Get-help -Name Copy-Item -Online
# Get parameter that accept pipeline input
Get-Help Get-ChildItem -Parameter * |
Where-Object {$_.pipelineInput -match 'true'} |
Select *
Get-Help about_*
Get-Help about_Functions
Or just use the built-in robocopy to copy source to destination.
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]
Take a look at the options for the /COPY:[copyflags] and /DCOPY switches.
# As per the ROBOCOPY /? usage info:
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:T :: COPY Directory Timestamps.
# For example:
ROBOCOPY c:src d:dest /MIR /COPY:DT /DCOPY:T
# Will copy all files and folders and preserve the date and time stamps.
ROBOCOPY c:src d:dest /MIR /COPY:DAT /DCOPY:T
Will copy all files and folders and preserve the date & time stamps and file attributes.
There is also another (and I believe deprecated?) switch /TIMFIX which does much the same as /COPY:DT but it doesn't fix the time stamps on folders.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395190%2fhow-to-change-the-creation-date-of-a-several-text-file-and-then-keep-it-when-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
All the answers you are after is in the PowerShell help files.
# Get a list of all functions
Get-Command -CommandType Function |
Out-GridView -PassThru -Title 'Available functions'
# Get a list of all commandlets
Get-Command -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available cmdlets'
# Get a list of all functions for the specified name
Get-Command -Name '*ADGroup*' -CommandType Function |
Out-GridView -PassThru -Title 'Available named functions'
# Get a list of all commandlets for the specified name
Get-Command -Name '*ADGroup**' -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available named cmdlet'
# get function / cmdlet details
(Get-Command -Name Get-ChildItem).Parameters
Get-help -Name Get-ChildItem -Examples
Get-help -Name Get-ChildItem -Full
Get-help -Name Get-ChildItem -Online
(Get-Command -Name ForEach).Parameters
Get-help -Name ForEach -Examples
Get-help -Name ForEach -Full
Get-help -Name ForEach -Online
(Get-Command -Name Copy-Item).Parameters
Get-help -Name Copy-Item -Examples
Get-help -Name Copy-Item -Full
Get-help -Name Copy-Item -Online
# Get parameter that accept pipeline input
Get-Help Get-ChildItem -Parameter * |
Where-Object {$_.pipelineInput -match 'true'} |
Select *
Get-Help about_*
Get-Help about_Functions
Or just use the built-in robocopy to copy source to destination.
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]
Take a look at the options for the /COPY:[copyflags] and /DCOPY switches.
# As per the ROBOCOPY /? usage info:
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:T :: COPY Directory Timestamps.
# For example:
ROBOCOPY c:src d:dest /MIR /COPY:DT /DCOPY:T
# Will copy all files and folders and preserve the date and time stamps.
ROBOCOPY c:src d:dest /MIR /COPY:DAT /DCOPY:T
Will copy all files and folders and preserve the date & time stamps and file attributes.
There is also another (and I believe deprecated?) switch /TIMFIX which does much the same as /COPY:DT but it doesn't fix the time stamps on folders.
add a comment |
All the answers you are after is in the PowerShell help files.
# Get a list of all functions
Get-Command -CommandType Function |
Out-GridView -PassThru -Title 'Available functions'
# Get a list of all commandlets
Get-Command -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available cmdlets'
# Get a list of all functions for the specified name
Get-Command -Name '*ADGroup*' -CommandType Function |
Out-GridView -PassThru -Title 'Available named functions'
# Get a list of all commandlets for the specified name
Get-Command -Name '*ADGroup**' -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available named cmdlet'
# get function / cmdlet details
(Get-Command -Name Get-ChildItem).Parameters
Get-help -Name Get-ChildItem -Examples
Get-help -Name Get-ChildItem -Full
Get-help -Name Get-ChildItem -Online
(Get-Command -Name ForEach).Parameters
Get-help -Name ForEach -Examples
Get-help -Name ForEach -Full
Get-help -Name ForEach -Online
(Get-Command -Name Copy-Item).Parameters
Get-help -Name Copy-Item -Examples
Get-help -Name Copy-Item -Full
Get-help -Name Copy-Item -Online
# Get parameter that accept pipeline input
Get-Help Get-ChildItem -Parameter * |
Where-Object {$_.pipelineInput -match 'true'} |
Select *
Get-Help about_*
Get-Help about_Functions
Or just use the built-in robocopy to copy source to destination.
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]
Take a look at the options for the /COPY:[copyflags] and /DCOPY switches.
# As per the ROBOCOPY /? usage info:
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:T :: COPY Directory Timestamps.
# For example:
ROBOCOPY c:src d:dest /MIR /COPY:DT /DCOPY:T
# Will copy all files and folders and preserve the date and time stamps.
ROBOCOPY c:src d:dest /MIR /COPY:DAT /DCOPY:T
Will copy all files and folders and preserve the date & time stamps and file attributes.
There is also another (and I believe deprecated?) switch /TIMFIX which does much the same as /COPY:DT but it doesn't fix the time stamps on folders.
add a comment |
All the answers you are after is in the PowerShell help files.
# Get a list of all functions
Get-Command -CommandType Function |
Out-GridView -PassThru -Title 'Available functions'
# Get a list of all commandlets
Get-Command -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available cmdlets'
# Get a list of all functions for the specified name
Get-Command -Name '*ADGroup*' -CommandType Function |
Out-GridView -PassThru -Title 'Available named functions'
# Get a list of all commandlets for the specified name
Get-Command -Name '*ADGroup**' -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available named cmdlet'
# get function / cmdlet details
(Get-Command -Name Get-ChildItem).Parameters
Get-help -Name Get-ChildItem -Examples
Get-help -Name Get-ChildItem -Full
Get-help -Name Get-ChildItem -Online
(Get-Command -Name ForEach).Parameters
Get-help -Name ForEach -Examples
Get-help -Name ForEach -Full
Get-help -Name ForEach -Online
(Get-Command -Name Copy-Item).Parameters
Get-help -Name Copy-Item -Examples
Get-help -Name Copy-Item -Full
Get-help -Name Copy-Item -Online
# Get parameter that accept pipeline input
Get-Help Get-ChildItem -Parameter * |
Where-Object {$_.pipelineInput -match 'true'} |
Select *
Get-Help about_*
Get-Help about_Functions
Or just use the built-in robocopy to copy source to destination.
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]
Take a look at the options for the /COPY:[copyflags] and /DCOPY switches.
# As per the ROBOCOPY /? usage info:
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:T :: COPY Directory Timestamps.
# For example:
ROBOCOPY c:src d:dest /MIR /COPY:DT /DCOPY:T
# Will copy all files and folders and preserve the date and time stamps.
ROBOCOPY c:src d:dest /MIR /COPY:DAT /DCOPY:T
Will copy all files and folders and preserve the date & time stamps and file attributes.
There is also another (and I believe deprecated?) switch /TIMFIX which does much the same as /COPY:DT but it doesn't fix the time stamps on folders.
All the answers you are after is in the PowerShell help files.
# Get a list of all functions
Get-Command -CommandType Function |
Out-GridView -PassThru -Title 'Available functions'
# Get a list of all commandlets
Get-Command -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available cmdlets'
# Get a list of all functions for the specified name
Get-Command -Name '*ADGroup*' -CommandType Function |
Out-GridView -PassThru -Title 'Available named functions'
# Get a list of all commandlets for the specified name
Get-Command -Name '*ADGroup**' -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available named cmdlet'
# get function / cmdlet details
(Get-Command -Name Get-ChildItem).Parameters
Get-help -Name Get-ChildItem -Examples
Get-help -Name Get-ChildItem -Full
Get-help -Name Get-ChildItem -Online
(Get-Command -Name ForEach).Parameters
Get-help -Name ForEach -Examples
Get-help -Name ForEach -Full
Get-help -Name ForEach -Online
(Get-Command -Name Copy-Item).Parameters
Get-help -Name Copy-Item -Examples
Get-help -Name Copy-Item -Full
Get-help -Name Copy-Item -Online
# Get parameter that accept pipeline input
Get-Help Get-ChildItem -Parameter * |
Where-Object {$_.pipelineInput -match 'true'} |
Select *
Get-Help about_*
Get-Help about_Functions
Or just use the built-in robocopy to copy source to destination.
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]
Take a look at the options for the /COPY:[copyflags] and /DCOPY switches.
# As per the ROBOCOPY /? usage info:
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:T :: COPY Directory Timestamps.
# For example:
ROBOCOPY c:src d:dest /MIR /COPY:DT /DCOPY:T
# Will copy all files and folders and preserve the date and time stamps.
ROBOCOPY c:src d:dest /MIR /COPY:DAT /DCOPY:T
Will copy all files and folders and preserve the date & time stamps and file attributes.
There is also another (and I believe deprecated?) switch /TIMFIX which does much the same as /COPY:DT but it doesn't fix the time stamps on folders.
answered Jan 17 at 6:25
postanotepostanote
1,04333
1,04333
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395190%2fhow-to-change-the-creation-date-of-a-several-text-file-and-then-keep-it-when-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown