This forum uses cookies. Click X button to hide this message. What is stored? / Privacy
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Zmena atributu datum a cas podle nazvu souboru

 
Post new topic   Reply to topic    Total Commander Forum Index -> Slovak and Czech Printable version
View previous topic :: View next topic  
Author Message
fgci
Junior Member
Junior Member


Joined: 24 Jan 2017
Posts: 11

PostPosted: Wed Apr 18, 2018 1:28 am    Post subject: Zmena atributu datum a cas podle nazvu souboru Reply with quote

Ahoj, potřeboval bych u velkého množství (stovky souborů) hromadně změnit atributy souborů: datum a čas podle názvu souboru.
Například soubor:
20170710_151341.jpg......................24.08.2017 18:42:12
na soubor s atributy času
20170710_151341.jpg......................10.07.2017 15:13:41

Díky
Back to top
View user's profile Send private message
Stefan2
Power Member
Power Member


Joined: 13 Sep 2007
Posts: 1964
Location: Europa

PostPosted: Wed Apr 18, 2018 2:00 am    Post subject: PowerShell: set timestamp from file name Reply with quote

Spusťte PowerShell ve složce se soubory a spusťte tento skript PoSh:


GCI|%{ $BN=$($_.BaseName -replace "_",""); $TS=[DateTime]::ParseExact($BN, 'yyyyMMddHHmmss', $null);$_.CreationTime=$TS; $_.LastWriteTime=$TS;$_.LastAccessTime=$TS }

jeden dlouhý řádek








Opět, další podrobnosti:
Code:
Get-ChildItem |
ForEach-Object{
     $BN=$($_.BaseName -replace "_","");
     $TS=[DateTime]::ParseExact($BN, 'yyyyMMddHHmmss', $null); 
     $_.CreationTime=$TS;
     $_.LastWriteTime=$TS;
     $_.LastAccessTime=$TS
}






 
_________________
The destination is one thing. Getting there is everything.
Back to top
View user's profile Send private message
fgci
Junior Member
Junior Member


Joined: 24 Jan 2017
Posts: 11

PostPosted: Wed Apr 18, 2018 2:48 am    Post subject: Reply with quote

Uf, chvíli jsem bojoval s PowerShellem, ale podařilo se.
Díky moc.
Back to top
View user's profile Send private message
fgci
Junior Member
Junior Member


Joined: 24 Jan 2017
Posts: 11

PostPosted: Wed Apr 18, 2018 3:39 am    Post subject: Reply with quote

Ještě jsem zjistil jiné varianty názvu souborů, které jsou delší a z nich to neumí zapsat atributy.
Dal by se skript upravit pro tyto delší názvy?
např.:
20170701_001610_001~2
20170709_215542(0)
20170709_223256_001

Děkuji
Back to top
View user's profile Send private message
Stefan2
Power Member
Power Member


Joined: 13 Sep 2007
Posts: 1964
Location: Europa

PostPosted: Wed Apr 18, 2018 4:10 am    Post subject: Reply with quote

Časová značka z názvů souborů, například:

20170710_151341.jpg
20170824_184212.jpg
20170701_001610_001 ~ 2.jpg
20170709_215542 (0).jpg
20170709_223256_001.jpg
(Název souboru začíná časovou značkou)



Snaž se:

GCI|%{ $BN=$($_.BaseName.Substring(0,15) -replace "_",""); $TS=[DateTime]::ParseExact($BN, 'yyyyMMddHHmmss', $null);$_.CreationTime=$TS; $_.LastWriteTime=$TS;$_.LastAccessTime=$TS }

--- jeden dlouhý řádek ---




 
_________________
The destination is one thing. Getting there is everything.
Back to top
View user's profile Send private message
fgci
Junior Member
Junior Member


Joined: 24 Jan 2017
Posts: 11

PostPosted: Wed Apr 18, 2018 4:50 am    Post subject: Reply with quote

To je ono, ještě jednou děkuji
Back to top
View user's profile Send private message
Hacker
Moderator
Moderator


Joined: 06 Feb 2003
Posts: 10917
Location: Bratislava, Slovakia

PostPosted: Wed Apr 18, 2018 8:11 am    Post subject: Reply with quote

fgci,
Quote:
Například soubor:
20170710_151341.jpg......................24.08.2017 18:42:12
na soubor s atributy času
20170710_151341.jpg......................10.07.2017 15:13:41

Oznacit subory, potom:
Files - Change Attributes - Change Plugin attributes:
tc - writedate - [=tc.name:7-8].[=tc.name:5-6].[=tc.name:1-4] [=tc.name:10-11]:[=tc.name:12-13]:[=tc.name:14-15]

HTH
Roman
_________________
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Back to top
View user's profile Send private message Send e-mail
fgci
Junior Member
Junior Member


Joined: 24 Jan 2017
Posts: 11

PostPosted: Thu Apr 19, 2018 12:28 am    Post subject: Reply with quote

Hacker wrote:
tc - writedate - [=tc.name:7-8].[=tc.name:5-6].[=tc.name:1-4] [=tc.name:10-11]:[=tc.name:12-13]:[=tc.name:14-15]
 

Díky moc, takhle jsem původně myslel, že to nějak musí jít v TC.Smile
I jsem to zkoušel přes Change Plugin attributes:, ale nepodařilo se mi vytvořit správnou hodnotu zápisu.
Ani vlastně teď, když vyberu v Property: writedate, tak v Choose plugin property mám výběr jen z :
creationdate
writedate
accessdate

ale není ve vlastnostech výběr nameSad
Back to top
View user's profile Send private message
Stefan2
Power Member
Power Member


Joined: 13 Sep 2007
Posts: 1964
Location: Europa

PostPosted: Thu Apr 19, 2018 12:55 am    Post subject: Reply with quote

>>ale není ve vlastnostech výber name

Plugin pracuje s dříve vybranými soubory.





(A pro obecné informace: divize "tc.name" musí mít za následek platnou razítko v každé zemi)





 
_________________
The destination is one thing. Getting there is everything.
Back to top
View user's profile Send private message
fgci
Junior Member
Junior Member


Joined: 24 Jan 2017
Posts: 11

PostPosted: Thu Apr 19, 2018 2:26 am    Post subject: Reply with quote

Stefan2 wrote:

Plugin pracuje s dříve vybranými soubory.
 

Mám to takto:
[img]https://postimg.cc/image/9rnqva2pn/[/img]
Back to top
View user's profile Send private message
Stefan2
Power Member
Power Member


Joined: 13 Sep 2007
Posts: 1964
Location: Europa

PostPosted: Thu Apr 19, 2018 3:29 am    Post subject: Reply with quote

1.) "tc.creationdate" provides the current CreationDate time stamp.
Use Hackers' example ([=tc.name:7-8].) instead to build the wanted time stamp from parts of the file name.

2.) Check "[√] Change plugin attributes" too.





 
_________________
The destination is one thing. Getting there is everything.
Back to top
View user's profile Send private message
Hacker
Moderator
Moderator


Joined: 06 Feb 2003
Posts: 10917
Location: Bratislava, Slovakia

PostPosted: Thu Apr 19, 2018 3:41 am    Post subject: Reply with quote

fgci,
Quote:
není ve vlastnostech výběr name

Nie je, musis to tam napisat rucne.

Roman
_________________
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Back to top
View user's profile Send private message Send e-mail
fgci
Junior Member
Junior Member


Joined: 24 Jan 2017
Posts: 11

PostPosted: Thu Apr 19, 2018 4:39 am    Post subject: Reply with quote

Hacker wrote:

Nie je, musis to tam napisat rucne.

Aha Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Slovak and Czech All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Imprint/Impressum: This site is maintained by Ghisler Software GmbH
Privacy Policy | Datenschutzerklärung | Politique de Confidentialité

Using phpBB © phpBB Group