Board logo

标题: [文件操作] [已解决]批处理如何修改文件中的日期为当前日期呢? [打印本页]

作者: iseeyou    时间: 2014-7-29 15:04     标题: [已解决]批处理如何修改文件中的日期为当前日期呢?

[attach]7495[/attach] 附件是个 test.fqf 文件,.fqf 是flashfxp的队列文件,我每天用计划任务备份网站当天产生的内容,所以每天都要手动修改队列里面的日期为当天日期,所以看看批处理能不能解决这个问题。

test.fqf 的内容里面有ASCII 1,但是不管,只修改日期部分,如图:
  1. 14-F9A58688aabbE:\www\web\2014-07\29/wwwroot/web/2014-07/29324537100
复制代码
[attach]7496[/attach]

关于.fqf文件格式官方文档说明:
  1. Queue Format (.fqf)
  2. Queue file format (.fqf) for reference.
  3. Each line consists of a single queue item and the fields separated by the (ASCII 1) character. Each line ends with a CR/LF.
  4. Type
  5. 0 = file
  6. 1 = folder
  7. 2 = action file
  8. 3 = action folder
  9. 4 = action other
  10. Transfer Direction
  11. 0 = -->
  12. 1 = <--
  13. 2 = Up Left
  14. 3 = Down Left
  15. 4 = Up Right
  16. 5 = Down Right
  17. 10+ =  failed transfer
  18. When generating a queue file externally you can use the site name as shown in the site manager. Site names start with a (ASCII 2). Queue files created by FlashFXP start with (ASCII 3) followed by a 32bit hash in Hex format (8 characters in length) immediately followed by the site name.
  19. For a FTP transfer you use - (ASCII 45) to identify the the local side.
  20. Each line consists of the following fields separated by (ASCII 1)
  21. 1. Type
  22. 2. Direction
  23. 3. Source Host (site name, see #1)
  24. 4. Target Host (site name, see #1)
  25. 5. Source Filename (full path to source)
  26. 6. Target Filename (full path to target)
  27. 7. File Size
  28. A line would consist of the following
  29. <Type><ASCII 1><Direction><ASCII 1><Source Host><ASCII 1><Target Host><ASCII 1><Source Filename><ASCII 1><Target Filename><ASCII 1><File Size><CR><LF>
  30. #1: The easiest way to obtain the site name is to open the sites.dat file in a text editor, the site name is the section name for the site and copy and paste the text because it includes special characters for group names, to make it easier, sites that you need to manually create queues for, you can simply create them in the root of the site manager so no group is used. this way they can be accessed directly by name shown in the site manager.
复制代码

作者: iseeyou    时间: 2014-7-31 23:18

试了解决不了
作者: hfg1977    时间: 2014-8-1 09:19

  1. ::修改时间格式
  2. reg add "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate /t REG_SZ /d yyyy-M-d /f>nul
  3. sed -i "s/[0-9]\{4\}-[0-9][0-9]\\[0-9][0-9]/%date:~0,7%\\%date:~8,2%/";"s/[0-9]\{4\}-[0-9][0-9]\/[0-9][0-9]/%date:~0,7%\/%date:~8,2%/" test.fqf
复制代码
sed 自行在本论坛下载
作者: iseeyou    时间: 2014-8-1 12:20

回复 3# hfg1977


    解决了,谢谢,要适应右下角新日期了。




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2