Package: py-robocopy
Package py-robocopyCopies files/data from one location to another.Description:py-robocopy is a Python library that serves as a wrapper for Robocopy, a robust file copying and synchronization tool available in Windows. It provides a convenient and straightforward interface to interact with Robocopy commands and perform advanced file operations within your Python applications.Key Features:Seamless Integration: py-robocopy seamlessly integrates with your Python projects, enabling you to leverage the capabilities of Robocopy directly from your codebase.File Copying and Synchronization: The library simplifies file copying and synchronization tasks by utilizing Robocopy's powerful features. You can specify source and destination directories, define files to be copied, and control various copying options.Advanced Copying Options: py-robocopy supports a wide range of advanced options provided by Robocopy. This includes copying subdirectories, preserving file attributes and timestamps, handling retries on failed copies, and mirroring directory structures.Logging and Error Handling: The library offers built-in logging functionality, allowing you to track the progress of copying operations and save the output to log files. It also provides error-handling mechanisms to manage exceptions during the copying process.Platform Compatibility: While Robocopy is primarily a Windows utility, py-robocopy is designed to work seamlessly on Windows systems where Robocopy is available.Use Cases:Automating file backup and synchronization tasks within Python applications.Building data migration and replication tools that require efficient file copying.Developing file management utilities with advanced copying options.Integrating file synchronization functionality into custom scripts or workflowsInstall the librarypip install py-robocopyUsagefrom RoboCopy import robocopy
robocopy.copy(<source-file-path>,<destination-file-path>,<options>)ExamplesBasic File Copyfrom RoboCopy import robocopy
robocopy.copy("C:\\source_folder", "D:\\destination_folder")This example demonstrates a basic file copy operation using robocopy. It copies all files and subdirectories from the source folderC:\\source_folderto the destination folderD:\\destination_folder.File Copy with Optionsfrom RoboCopy import robocopy

options = '/Z /R:3 /W:5'
robocopy.copy("C:\\source_folder", "D:\\destination_folder", options)In this example, theoptionsparameter is used to specify additional options for the copying operation. The/Zoption enables restartable mode, allowing the copying process to be resumed in case of interruption. The/R:3option sets the number of retries on failed copies to 3, and the/W:5option sets the wait time between retries to 5 seconds.Syntaxrobocopy <source> <destination> [<file>[ ...]] [<options>]For example, to copy a file named yearly-report.mov from c:\reports to a file share \marketing\videos while enabling multi-threading for higher performance (with the /mt parameter) and the ability to restart the transfer in case it's interrupted (with the /z parameter), type:robocopy c:\reports "\\marketing\videos" yearly-report.mov /mt /zFor more details :https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopyParametersParameter	DescriptionParameterDescription<source>Specifies the path to the source directory.<destination>Specifies the path to the destination directory.<file>Specifies the file or files to be copied. Wildcard characters (*or?) are supported. If you don't specify this parameter,*.*is used as the default value.<options>Specifies the options to use with therobocopycommand, includingcopy,file,retry,logging, andjoboptions.Copy optionsOptionDescription/sCopies subdirectories. This option automatically excludes empty directories./eCopies subdirectories. This option automatically includes empty directories./lev:<n>Copies only the topnlevels of the source directory tree./zCopies files in restartable mode. In restartable mode, should a file copy be interrupted, Robocopy can pick up where it left off rather than recopying the entire file./bCopies files in backup mode allowing Robocopy to override file and folder permission settings (ACLs). This allow copying of files you might otherwise not have access to assuming it's being run under an account with sufficient privileges./zbCopies files in restartable mode. If file access is denied, switches to backup mode./jCopies using unbuffered I/O (recommended for large files)./efsrawCopies all encrypted files in EFS RAW mode./copy:<copyflags>Specifies which file properties to copy. The valid values for this option are:D- DataA- AttributesT- Time stampsX- Skip alt data streamsS- NTFS access control list (ACL)O- Owner informationU- Auditing informationThe default value for the/COPYoption isDAT(data, attributes, and time stamps). TheXflag is ignored if either/Bor/ZBis used./dcopy:<copyflags>Specifies what to copy in directories. The valid values for this option are:D- DataA- AttributesT- Time stampsE- Extended attributeX- Skip alt data streamsThe default value for this option isDA(data and attributes)./secCopies files with security (equivalent to/copy:DATS)./copyallCopies all file information (equivalent to/copy:DATSOU)./nocopyCopies no file information (useful with/purge)./secfixFixes file security on all files, even skipped ones./timfixFixes file times on all files, even skipped ones./purgeDeletes destination files and directories that no longer exist in the source. Using this option with the/eoption and a destination directory, allows the destination directory security settings to not be overwritten./mirMirrors a directory tree (equivalent to/eplus/purge). Using this option with the/eoption and a destination directory, overwrites the destination directory security settings./movMoves files, and deletes them from the source after they're copied./moveMoves files and directories, and deletes them from the source after they're copied./a+:[RASHCNET]Adds the specified attributes to copied files.  The valid values for this option are:R- Read onlyA- ArchiveS- SystemH- HiddenC- CompressedN- Not content indexedE- EncryptedT- Temporary/a-:[RASHCNETO]Removes the specified attributes from copied files. The valid values for this option are:R- Read onlyA- ArchiveS- SystemH- HiddenC- CompressedN- Not content indexedE- EncryptedT- TemporaryO- Offline/createCreates a directory tree and zero-length files only./fatCreates destination files by using 8.3 character-length FAT file names only./256Turns off support for paths longer than 256 characters./mon:<n>Monitors the source and runs again when more thannchanges are detected./mot:<m>Monitors the source and runs again inmminutes if changes are detected./rh:hhmm-hhmmSpecifies run times when new copies may be started./pfChecks run times on a per-file (not per-pass) basis./ipg:<n>Specifies the inter-packet gap to free bandwidth on slow lines./sjCopies junctions (soft-links) to the destination path instead of link targets./slDon't follow symbolic links and instead create a copy of the link./mt:<n>Creates multi-threaded copies withnthreads.nmust be an integer between 1 and 128. The default value fornis 8. For better performance, redirect your output using/logoption.The/mtparameter can't be used with the/ipgand/efsrawparameters./nodcopyCopies no directory info (the default/dcopy:DAis done)./nooffloadCopies files without using the Windows Copy Offload mechanism./compressRequests network compression during file transfer, if applicable./sparseEnables retaining sparse state during copy.File selection optionsOptionDescription/aCopies only files for which theArchiveattribute is set./mCopies only files for which theArchiveattribute is set, and resets theArchiveattribute./ia:[RASHCNETO]Includes only files for which any of the specified attributes are set.  The valid values for this option are:R- Read onlyA- ArchiveS- SystemH- HiddenC- CompressedN- Not content indexedE- EncryptedT- TemporaryO- Offline/xa:[RASHCNETO]Excludes files for which any of the specified attributes are set. The valid values for this option are:R- Read onlyA- ArchiveS- SystemH- HiddenC- CompressedN- Not content indexedE- EncryptedT- TemporaryO- Offline/xf<filename>[ ...]Excludes files that match the specified names or paths. Wildcard characters (*and?) are supported./xd<directory>[ ...]Excludes directories that match the specified names and paths./xcExcludes existing files with the same timestamp, but different file sizes./xnSource directory files newer than the destination are excluded from the copy./xoSource directory files older than the destination are excluded from the copy./xxExcludes extra files and directories present in the destination but not the source. Excluding extra files won't delete files from the destination./xlExcludes "lonely" files and directories present in the source but not the destination. Excluding lonely files prevents any new files from being added to the destination./imInclude modified files (differing change times)./isIncludes the same files. Same files are identical in name, size, times, and all attributes./itIncludes "tweaked" files. Tweaked files have the same name, size, and times, but different attributes./max:<n>Specifies the maximum file size (to exclude files bigger thannbytes)./min:<n>Specifies the minimum file size (to exclude files smaller thannbytes)./maxage:<n>Specifies the maximum file age (to exclude files older thanndays or date)./minage:<n>Specifies the minimum file age (exclude files newer thanndays or date)./maxlad:<n>Specifies the maximum last access date (excludes files unused sincen)./minlad:<n>Specifies the minimum last access date (excludes files used sincen) Ifnis less than 1900,nspecifies the number of days. Otherwise,nspecifies a date in the format YYYYMMDD./xjExcludes junction points, which are normally included by default./fftAssumes FAT file times (two-second precision)./dstCompensates for one-hour DST time differences./xjdExcludes junction points for directories./xjfExcludes junction points for files.Robocopy, short for "Robust File Copy," is a command-line utility available in Windows operating systems. It is used for copying and synchronizing files and directories, and it offers more advanced features than the regular file copy command (copy or xcopy). Robocopy was first introduced with the Windows NT 4.0 Resource Kit and has since been included as a standard command-line tool in subsequent versions of Windows.Robocopy is a powerful tool for advanced file copying and synchronization tasks, and it can be particularly useful when dealing with large file sets or when you need to maintain file attributes, timestamps, and NTFS permissions during the copying process.