Newbie: BRC: Wrong timezone / time

Post any Bulk Rename Command support requirements here. Open to all registered users.

Newbie: BRC: Wrong timezone / time

Postby unitz » Wed Jul 20, 2016 2:16 am

Hi,

Trying to run a simple BRC command and trying to rename *.docx to include the current (Now) date and time. Unfortunately the resulting name of the file is following the GMT time. I am in PST zone and would prefer to have the local time in the renamed filename. I've checked the date and time from cmd and also checked date and time settings in windows. All show the correct PST time but BRC appends GMT time. I am running Win7 64 bit. Any ideas?

The command that I am using to test the output file name is :

C:\DHM\rtfm\Bulk Rename>brc64 /pattern:*.docx /AppendDate:N:S:_::10:%a%d%B%H%M%z

The resulting file name is

hello_Wed20July0115Pacific Daylight Time.docx
Currently the pacific time is 1815 on 19th July.

Thanks for your help, :)
DV
unitz
 
Posts: 2
Joined: Wed Jul 20, 2016 2:07 am

Re: Newbie: BRC: Wrong timezone / time

Postby therube » Wed Jul 20, 2016 3:36 am

From Time Zone Issue Using Custom Date Formats, the issue has been around for years.

And it also mentions the problem with the wrong day being returned.

Only thing I can think is to do something ugly, like /REPLACECS:##:##, where you're manually adjusting for the hour difference.
(Like I said, ugly ;-).) That would take care of the "hour" number part but would do nothing if it happens that the day ends up incorrect.


Maybe you could do something with the UNIX touch command:
Code: Select all
Usage: touch [OPTION]... FILE...
Update the access and modification times of each FILE to the current time.

Mandatory arguments to long options are mandatory for short options too.
  -a                     change only the access time
  -c, --no-create        do not create any files
  -d, --date=STRING      parse STRING and use it instead of current time
  -f                     (ignored)
  -m                     change only the modification time
  -r, --reference=FILE   use this file's times instead of current time
  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time
  --time=WORD            change the specified time:
                           WORD is access, atime, or use: equivalent to -a
                           WORD is modify or mtime: equivalent to -m
      --help     display this help and exit
      --version  output version information and exit

Note that the -d and -t options accept different time-date formats.

Report bugs to <bug-coreutils@gnu.org>.

(Note that it too seems to fart on hour, depending when you run the command, where when uses -d, the hour can end up being off by 1 hour.)

I made an approximation of an old SETTIME.COM command, settime.bat:
Code: Select all
@ECHO OFF

ECHO  SETTIME  sets a file's date to the "same" file, named "abc"
ECHO  a sort of more current variation of my old ancient DOS settime program
ECHO.
ECHO  therube 02/20/2015
ECHO.
ECHO  File to change the date of:  %1

FOR   %%i in (%1) do  SET   BASENAME=%%~dpiabc
ECHO  reference file (aka "abc"):  "%BASENAME%"
ECHO.
ls -l %1
ls -l "%BASENAME%"
ECHO.

PAUSE

touch %1 --reference="%BASENAME%" -d 14:01:00
ls -l %1

PAUSE
EXIT

I'm quite adept at using Norton Commander & very quickly changing a files time stamp to that of some other files. Typically I name the source file "abc", so I carried that behavior over here [so in many cases I'll end up renaming the source file to 'abc' & then running settime.bat against the target file (from a SendTo context-menu)].

ls is the UNIX directory list command.
-d 14:01:00 is 2:PM, but depending, you it might end up at 3:PM (the 'ol +1 hour).
Stinks that that happens, but I'm forcing the time part as it is, & if it reads 2:01:00 or 3:01:00, I'm OK with that.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Newbie: BRC: Wrong timezone / time

Postby unitz » Wed Jul 20, 2016 7:07 am

Thank therube for mentioning that is a known behavior / bug. I'll try out the suggestions / scripts that you have mentioned and / or I'll just end up not using the time switches in the custom date. It might just suffice for the task.

Thanks again,
DV. :)
unitz
 
Posts: 2
Joined: Wed Jul 20, 2016 2:07 am


Return to BRC Support