- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的脚本,用于移动超过一定天数的文件-
mkdir F:\TempRemoval
robocopy "F:\Example" "F:\TempRemoval" /move /e /minage:1
del "F:\TempRemoval\*.*" /f /s /q
rmdir F:\TempRemoval /s /q
exit
我遇到的唯一问题是我需要的某些文件被添加到这个文件夹中,这些文件已有 3-4 年历史了。我知道一个可行的解决方案,但我不确定如何编码。
我希望 robocopy 仅搜索第一级文件夹的日期,即
c:\folders\delete
我希望它仅搜索“文件夹”中列出的文件和文件夹的日期 - 并根据该结果移动整个文件夹和子文件夹/文件。
有办法做到这一点吗?
最佳答案
查看 robocopy 的语法/用法:
/MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
/MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
/MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
/MINLAD:n :: MINimum Last Access Date - exclude files used since n.
(If n < 1900 then n = n days, else n = YYYYMMDD date).
这是完整的 Robocopy 语法:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Thu Feb 23 12:25:50 2012
Usage :: ROBOCOPY source destination [file [file]...] [options]
source :: Source Directory (drive:\path or \\server\share\path).
destination :: Destination Dir (drive:\path or \\server\share\path).
file :: File(s) to copy (names/wildcards: default is "*.*").
::
:: Copy options :
::
/S :: copy Subdirectories, but not empty ones.
/E :: copy subdirectories, including Empty ones.
/LEV:n :: only copy the top n LEVels of the source directory tree.
/Z :: copy files in restartable mode.
/B :: copy files in Backup mode.
/ZB :: use restartable mode; if access denied use Backup mode.
/EFSRAW :: copy all encrypted files in EFS RAW mode.
/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.
/SEC :: copy files with SECurity (equivalent to /COPY:DATS).
/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
/NOCOPY :: COPY NO file info (useful with /PURGE).
/SECFIX :: FIX file SECurity on all files, even skipped files.
/TIMFIX :: FIX file TIMes on all files, even skipped files.
/PURGE :: delete dest files/dirs that no longer exist in source.
/MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
/MOV :: MOVe files (delete from source after copying).
/MOVE :: MOVE files AND dirs (delete from source after copying).
/A+:[RASHCNET] :: add the given Attributes to copied files.
/A-:[RASHCNET] :: remove the given Attributes from copied files.
/CREATE :: CREATE directory tree and zero-length files only.
/FAT :: create destination files using 8.3 FAT file names only.
/256 :: turn off very long path (> 256 characters) support.
/MON:n :: MONitor source; run again when more than n changes seen.
/MOT:m :: MOnitor source; run again in m minutes Time, if changed.
/RH:hhmm-hhmm :: Run Hours - times when new copies may be started.
/PF :: check run hours on a Per File (not per pass) basis.
/IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.
/SL :: copy symbolic links versus the target.
/MT[:n] :: Do multi-threaded copies with n threads (default 8).
n must be at least 1 and not greater than 128.
This option is incompatible with the /IPG and /EFSRAW options.
Redirect output using /LOG option for better performance.
::
:: File Selection Options :
::
/A :: copy only files with the Archive attribute set.
/M :: copy only files with the Archive attribute and reset it.
/IA:[RASHCNETO] :: Include only files with any of the given Attributes set.
/XA:[RASHCNETO] :: eXclude files with any of the given Attributes set.
/XF file [file]... :: eXclude Files matching given names/paths/wildcards.
/XD dirs [dirs]... :: eXclude Directories matching given names/paths.
/XC :: eXclude Changed files.
/XN :: eXclude Newer files.
/XO :: eXclude Older files.
/XX :: eXclude eXtra files and directories.
/XL :: eXclude Lonely files and directories.
/IS :: Include Same files.
/IT :: Include Tweaked files.
/MAX:n :: MAXimum file size - exclude files bigger than n bytes.
/MIN:n :: MINimum file size - exclude files smaller than n bytes.
/MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
/MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
/MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
/MINLAD:n :: MINimum Last Access Date - exclude files used since n.
(If n < 1900 then n = n days, else n = YYYYMMDD date).
/XJ :: eXclude Junction points. (normally included by default).
/FFT :: assume FAT File Times (2-second granularity).
/DST :: compensate for one-hour DST time differences.
/XJD :: eXclude Junction points for Directories.
/XJF :: eXclude Junction points for Files.
::
:: Retry Options :
::
/R:n :: number of Retries on failed copies: default 1 million.
/W:n :: Wait time between retries: default is 30 seconds.
/REG :: Save /R:n and /W:n in the Registry as default settings.
/TBD :: wait for sharenames To Be Defined (retry error 67).
::
:: Logging Options :
::
/L :: List only - don't copy, timestamp or delete any files.
/X :: report all eXtra files, not just those selected.
/V :: produce Verbose output, showing skipped files.
/TS :: include source file Time Stamps in the output.
/FP :: include Full Pathname of files in the output.
/BYTES :: Print sizes as bytes.
/NS :: No Size - don't log file sizes.
/NC :: No Class - don't log file classes.
/NFL :: No File List - don't log file names.
/NDL :: No Directory List - don't log directory names.
/NP :: No Progress - don't display percentage copied.
/ETA :: show Estimated Time of Arrival of copied files.
/LOG:file :: output status to LOG file (overwrite existing log).
/LOG+:file :: output status to LOG file (append to existing log).
/UNILOG:file :: output status to LOG file as UNICODE (overwrite existing log).
/UNILOG+:file :: output status to LOG file as UNICODE (append to existing log).
/TEE :: output to console window, as well as the log file.
/NJH :: No Job Header.
/NJS :: No Job Summary.
/UNICODE :: output status as UNICODE.
::
:: Job Options :
::
/JOB:jobname :: take parameters from the named JOB file.
/SAVE:jobname :: SAVE parameters to the named job file
/QUIT :: QUIT after processing command line (to view parameters).
/NOSD :: NO Source Directory is specified.
/NODD :: NO Destination Directory is specified.
/IF :: Include the following Files.
关于Robocopy 移动早于,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9417913/
我在 robocopy 中得到了如下所述的命令 ROBOCOPY 源目标 [文件…[文件]…..] [选项] 来源:源目录目的地:目的地目录文件:要复制的文件。 请告诉我们“\server\share
我一直很高兴使用 robocopy 将我的计算机备份到外部 USB 驱动器。这很棒,因为它只复制已更改/更新/新的文件。我可以将外部驱动器带到任何计算机上并查看它,就像它是计算机上的另一个驱动器一样。
我想在使用 Robocopy 日志时避免所有现有文件名和目标文件夹的详细信息。 只想显示复制的文件列表及其详细信息。 因此,我可以通过避免日志中现有的文件详细信息来节省 robocopy 日志文件的大
我得到了几个用于文件同步的旧版 bat 脚本。他们使用机器人复制。根据documentation ,默认有重试机制:一百万 重试, 30 秒 重试之间。 因此,如果我理解得很好,如果出现问题(例如目标
有一个脚本正在运行,它将一堆文件夹从一个卷镜像到另一个卷。问题是现在目标文件夹中的子目录不属于原始镜像脚本的一部分。它们是独立的子目录,一旦镜像开始,我不希望它们被清除。有没有办法让我使用 /xd在
在此先感谢您的帮助。 我正在使用 ROBOCOPY 将一些文件从驱动器复制到同一台计算机上的另一个驱动器。每隔一段时间,我就会出错。它没有重试 999 次,而是重试了一次但失败了。我有几个问题: 为什
有没有办法使用 robocopy 命令排除空文件(0 字节)的复制? 除了其他文件之外,我有一个包含数千个空文件的源,目标也具有相同的文件名但不为空。我想将除空文件之外的所有内容从源复制到目标。 最佳
使用 Robocopy 从一个来源复制到多个目的地是否可能且安全? 我的意思是,在 bat 文件中是这样的: ROBOCOPY source dest_1 ROBOCOPY source dest_2
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以使为on-topic。 6
是否有一种方法可以让 robocopy 将文件从一个目录复制到另一个目录并覆盖同名文件,以便目标目录包含较小的文件。 例如 dirA -- file1 (12Kb) -- file2 (2Kb)
这是我的脚本,用于移动超过一定天数的文件- mkdir F:\TempRemoval robocopy "F:\Example" "F:\TempRemoval" /move /e /minage:1
我在使用 robocopy 时遇到问题。我想用它来备份系统光盘,并且我想排除一些系统文件夹。但它仍在尝试复制其中一些文件夹。我的批处理文件是这样的: robocopy c:\ l:\C\ /r:1 /
如何将此 xcopy 命令转换为 Robocopy: xcopy *.* "C:\DestinationFolder\" 请记住,运行命令的当前文件夹会动态更改(因此源文件夹提前未知)。 谢谢。 最佳
对于通配符标志,我可以说只复制名称中同时包含 sp 和 MPK 的文件吗? $source = "D:\scripts\watcher\2015-007" $destination = "K:\pub
我正在用 robocopy 编写一个 powershell 脚本来从列表中复制“完整的”unc/文件名路径。我遇到的问题是 robocopy 似乎在我的源路径末尾添加了一个 \。 我有一个 C:\te
我很想知道是什么让 Robocopy(强大的文件复制)如此快速和强大。任何机构都知道用于 Robocopy 的 API/Algo 是什么?有人学过Robocopy吗? 我问是因为我必须编写一个方法(在
这是我制作的一些代码:) @echo off set source="R:\Contracts\" set destination="R:\Contracts\Sites\" ROBOCOPY %so
我们正在将文件从一个共享迁移到另一个共享。我们构建了一个工具,用户可以在其中选择要复制到目标共享的目录和/或单个文件。该工具为用户选择的集合中的每个文件或目录生成单独的 RoboCopy 命令。 如果
在某些Robocopy选项中,例如: /a+:[RASHCNET]-将指定的属性添加到复制的文件中。 /a-:[RASHCNET]-从复制的文件中删除指定的属性。 [RASHCNET]指的是什么属性?
我正在尝试完成我的批处理脚本,但在某些情况下它会失败。 这是我正在运行的命令: ROBOCOPY "C:\test\dash2\Hello - 4\" "C:\test\dash2\Hello - 4
我是一名优秀的程序员,十分优秀!