TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: David Bethel on August 14, 2017, 09:19:48 AM

Title: dos_touch
Post by: David Bethel on August 14, 2017, 09:19:48 AM
Good morning,

Has anyone successfully used DosLIBs dos_touch ?

I thousands of files to change the file date only to a new value.  I'm not finding much as far as as details

TIA  -David
Title: Re: dos_touch
Post by: David Bethel on August 14, 2017, 09:55:25 AM
Well it looks like dos_touch only sets the time / date to the current settings.

I'll search some more  Thanks!  -David
Title: Re: dos_touch
Post by: tombu on August 14, 2017, 10:33:21 AM
What are you looking to do?  Would a date field do the trick?
Title: Re: dos_touch
Post by: David Bethel on August 14, 2017, 10:43:01 AM
I am trying to edit the date on a lot of index.htm files to a date that is stored within the file ( it's true creation date )

Over the years I've done global editing on a lot of the these files and each time the file date is changed to the date of the edit.  Maybe 4,000 out of 8,500 have this problem.

I was hoping dos_lib could do the trick.  Maybe I can find an old Norton utitlity ( all files names are 8.3 format )

-David
Title: Re: dos_touch
Post by: roy_043 on August 14, 2017, 11:16:29 AM
Total Commander (http://www.ghisler.com/) can do this.
Title: Re: dos_touch
Post by: David Bethel on August 14, 2017, 11:37:42 AM
Thanks!  I'll try it !
Title: Re: dos_touch
Post by: Mark on August 14, 2017, 11:48:34 AM
There is a touch utility here .... http://gnuwin32.sourceforge.net/packages/coreutils.htm
Title: Re: dos_touch
Post by: David Bethel on August 14, 2017, 12:08:40 PM
That looks powerful as well !
Title: Re: dos_touch
Post by: JohnK on August 14, 2017, 03:29:48 PM
Mark, I don't think touch (gnu) alone will do what the OP wants.  You'd have to use grep or find along with touch I imagine.

touch --help
Code: [Select]
Usage: touch [OPTION]... FILE...
Update the access and modification times of each FILE to the current time.

A FILE argument that does not exist is created empty, unless -c or -h
is supplied.

A FILE argument string of - is handled specially and causes touch to
change the times of the file associated with standard output.

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)
  -h, --no-dereference   affect each symbolic link instead of any referenced
                         file (useful only on systems that can change the
                         timestamps of a symlink)
  -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.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report touch translation bugs to <http://translationproject.org/team/>
Full documentation at: <http://www.gnu.org/software/coreutils/touch>
or available locally via: info '(coreutils) touch invocation'
Title: Re: dos_touch
Post by: David Bethel on August 14, 2017, 04:51:22 PM
I found 1 that is pretty straight forward  nircmd

in a batch file

Code: [Select]
c:\download\nircmd.exe setfiletime "z:\web\zoiba\index.htm" "10-05-2008 01:34:22" "30-03-2001 01:34:22"

A little picky on the exact format


1,785 calls in a single bat file for 1 client.  No crashes


So far so good.   thanks  -David
Title: Re: dos_touch
Post by: Peter2 on August 16, 2017, 01:24:23 PM
I don't remember i detail, but dos_touch works if you read all the informations in detail. And I think you have consider this information too:
https://wiki.mcneel.com/doslib/dos_strformatdate
Title: Re: dos_touch
Post by: David Bethel on August 17, 2017, 06:11:32 AM
Thanks,  My version of DosLIB is very old.  Apparently the function has been updated over the year.  Mine will only accept 1 parameter ( the file name )

-David