My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and index you

XCOPY Command

Xcopy

Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
[/EXCLUDE:file1[+file2][+file3]...]



source: Specifies the file(s) to copy.

destination: Specifies the location and/or name of new files.

/A : Copies only files with the archive attribute set,doesn't change the attribute.
/M:Copies only files with the archive attribute set,turns off the archive attribute.
/D : m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
/EXCLUDE: file1[+file2][+file3]... Specifies a list of files containing strings. When any of the
strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively.
/P: Prompts you before creating each destination file.
/S: Copies directories and subdirectories except empty ones.
/E: Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/V: Verifies each new file.
/W: Prompts you to press a key before copying.
/C: Continues copying even if errors occur.
/I: If destination does not exist and copying more than one file,assumes that destination must be a directory.
/Q:Does not display file names while copying.
/F:Displays full source and destination file names while copying.
/L: Displays files that would be copied.
/H:Copies hidden and system files also.
/R:Overwrites read-only files.
/T:Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.
/U: Copies only files that already exist in destination.
/K: Copies attributes. Normal Xcopy will reset read-only attributes.
/N: Copies using the generated short names.
/O: Copies file ownership and ACL information.
/X:Copies file audit settings (implies /O).
/Y:Suppresses prompting to confirm you want to overwrite an existing destination file.
/-Y:Causes prompting to confirm you want to overwrite an existing destination file.
/Z:Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

Batch file script to copy all files:

This is a small script I use to copy file quickly from source to destination. This script should work under Windows XP, 2000, 2003, 98/95 etc.
Syntax:
Script accept two command line argument as follows:
CopyNonEmptyFolder.bat {source} {destination}
Where,

CopyNonEmptyFolder.bat - This script copies files and non-empty directories, including non-empty subdirectories using Windows xcopy program. The structure of destination will be similar to source after running the script. You must pass following two arguments/parameters

source – Use to specify the location and names of the file/directory you want to copy.
destination - Use to specify the destination of the files you want to copy.

How do I use this script?

For example copy all *.doc file from D:\AMIT KUMAR to E:\AMIT KUMAR directory, you need to execute script as follows:

Cd D:\AMIT KUMAR
CopyNonEmptyFolder.bat *.doc E:\AMIT KUMAR

OR copy all files from D:\AMIT KUMAR to E:\AMIT KUMAR

CopyNonEmptyFolder.bat D:\AMIT KUMAR to E:\AMIT KUMAR

Note:

• If destination folder not exits it, will create automatically.
• If destination folder exists, it will delete automatically.



CopyNonEmptyFolder.bat source code


@rem BATCH FILE
@echo off
if %1 == "" goto error1
if %2 == "" goto error2
@rem * Copy from source to destination including subdirs
@rem Delete all files
DEL /F /Q /S %2%\*.*
@rem Delete all folders
REM deltree %2% /Y
xcopy %1 %2 /S /I /Y
goto endofprogram
:error1
echo You must provide source
echo Syntax:
echo %0 source destination
goto endofprogram
:error2
echo You must provide destination
echo Syntax:
echo %0 source destination
goto endofprogram
:endofprogram


Batch file script to copy all files into one folder:

This is a small script I use to copy file quickly from source to destination. This script should work under Windows XP, 2000, 2003, 98/95 etc.

Syntax:

Script accept two command line argument as follows:

CopyAllFiles.bat {source} {destination}

Where,

CopyAllFiles.bat - This script copies all files/specific extension files into one folder. You must pass following two arguments/parameters

source – Use to specify the location and names of the file/directory you want to copy.
destination - Use to specify the destination of the files you want to copy.

How do I use this script?

For example copy all *.wsp file from D:\AMIT KUMAR to E:\AMIT KUMAR directory, you need to execute script as follows:

Change the following line in the script file:


For /F "Delims=" %%! in ('Dir %SOURCE_DIR%\*.wsp /b /s /a-d 2^>nul') do (


Cd D:\AMIT KUMAR

CopyAllFiles.bat " D:\AMIT KUMAR " " E:\AMIT KUMAR "

OR copy all files from D:\AMIT KUMAR to E:\AMIT KUMAR

Execute script as follows:


Change the following line in the script file:


For /F "Delims=" %%! in ('Dir %SOURCE_DIR% /b /s /a-d 2^>nul') do (


Cd D:\AMIT KUMAR

CopyAllFiles.bat " D:\AMIT KUMAR " " E:\AMIT KUMAR "

Note:

• If destination folder not exits it, will create automatically.
• If destination folder exists, it will delete automatically.

CopyAllFiles.bat source code:


@echo off
title WAIT !
Set SOURCE_DIR=%1
set DESTINATION_DIR=%2
Set "_report=c:\logxcopy.txt"
IF NOT EXIST %SOURCE_DIR% (echo.Could not find Source Dir %SOURCE_DIR% &GoTo:done)
DEL /F /Q /S %DESTINATION_DIR%\*.*
Rd %DESTINATION_DIR%\ /S /Q



echo Copying WSP from %SOURCE_DIR% to %DESTINATION_DIR%
:: overwrite previous log
>"%_report%" (
echo.%date% - %time%
echo.---------------------------------------------------
echo.
)
:: copy files
For /F "Delims=" %%! in ('Dir %SOURCE_DIR%\*.wsp /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%DESTINATION_DIR%\" /i /y /h /f /c >>"%_report%",2>&1)
)
:done
title,Done.......

Comments

Popular posts from this blog

Sitecore GraphQL Queries

Sitecore Experience Edge GraphQL Queries

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container