├── Extractor and backup.bat └── README.md /Extractor and backup.bat: -------------------------------------------------------------------------------- 1 | :: variables 2 | /min 3 | SET odrive=%odrive:~0,2% 4 | set backupcmd=xcopy /s /c /d /e /h /i /r /y /g 5 | echo off 6 | %backupcmd% "%USERPROFILE%\pictures" "%drive%\all\My pics" 7 | %backupcmd% "%USERPROFILE%\Favorites" "%drive%\all\Favorites" 8 | %backupcmd% "%USERPROFILE%\videos" "%drive%\all\vids" 9 | %backupcmd% "%USERPROFILE%\Download" "%drive%\all\Download" 10 | %backupcmd% "%USERPROFILE%\Desktop" "%drive%\all\Desktop" 11 | %backupcmd% "%USERPROFILE%\Music" "%drive%\all\Music" 12 | %backupcmd% "%USERPROFILE%\Documents" "%drive%\all\Documents" 13 | @echo off -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Data-Extractor-and-backup 2 | This batch file automates the process of backing up specific user directories (such as Pictures, Favorites, Videos, Downloads, Desktop, Music, and Documents) from the user profile to a target drive. 3 | 4 | # Functionality 5 | Backup Directories: The script uses the xcopy command to copy all the contents from the user's profile folders (such as Pictures, Favorites, Videos, etc.) to a specified destination drive. 6 | Incremental Backup: It only copies new or modified files, skipping files that haven't changed. 7 | Hidden and System Files: The script ensures that hidden and system files are copied as well. 8 | File Attributes and Permissions: It maintains file attributes, permissions, and timestamps during the copy process. 9 | # Key Commands Used 10 | SET odrive: Retrieves the system's drive letter and stores it in the variable %odrive%. 11 | xcopy: This is the core command used to copy files and folders. The flags used include: 12 | /s: Copies directories and subdirectories, except empty ones. 13 | /c: Continues copying even if errors occur. 14 | /d: Copies only files that have been changed. 15 | /e: Copies all subdirectories, including empty ones. 16 | /h: Copies hidden and system files. 17 | /i: Assumes the destination is a directory if it's not clear. 18 | /r: Overwrites read-only files. 19 | /y: Suppresses prompting when overwriting files. 20 | /g: Copies files without altering the encryption status. 21 | 22 | # Usage 23 | Ensure the Destination Drive is Correct: The script uses %drive% as the destination where backups will be stored. Modify this variable to point to your backup drive (e.g., D:\, E:\, etc.). 24 | Run the Script: Simply double-click the .bat file to execute the backup process. You can also schedule this batch file using Task Scheduler for periodic backups. 25 | 26 | Example: 27 | # batch 28 | Copy code 29 | %backupcmd% "%USERPROFILE%\pictures" "D:\backups\My pics" 30 | This line copies the Pictures directory from the current user profile to the D:\backups\My pics directory. 31 | 32 | Supported Directories 33 | Pictures: %USERPROFILE%\pictures 34 | Favorites: %USERPROFILE%\Favorites 35 | Videos: %USERPROFILE%\videos 36 | Downloads: %USERPROFILE%\Download 37 | Desktop: %USERPROFILE%\Desktop 38 | Music: %USERPROFILE%\Music 39 | Documents: %USERPROFILE%\Documents 40 | # Customization 41 | You can easily modify the directories or destination paths by editing the paths in the script to suit your backup needs. 42 | # Disclaimer 43 | This is for educational purposes only 44 | --------------------------------------------------------------------------------