Untitled
unknown
plain_text
a year ago
1.1 kB
8
Indexable
#!/bin/bash # Source folder containing files to be segregated source_folder="C:\Users\Mounika\Desktop\watermelon-images" # Destination folder destination_folder="C:\Users\Mounika\Documents\destfolder" # Destination folder prefix destination_prefix="split" # Counter for split folders split_count=1 # Create the destination folder if it doesn't exist mkdir -p "${destination_folder}" # Create the first split folder mkdir "${destination_folder}/${destination_prefix}${split_count}" # Counter for files in current split folder file_count=0 # Loop through files in source folder for file in "${source_folder}"/*; do # Copy file to current split folder cp "$file" "${destination_folder}/${destination_prefix}${split_count}" # Increment file count ((file_count++)) # Check if 100 files have been copied, then create a new split folder if [ $file_count -eq 100 ]; then ((split_count++)) mkdir "${destination_folder}/${destination_prefix}${split_count}" file_count=0 fi done
Editor is loading...
Leave a Comment