19 lines
286 B
Bash
Raw Permalink Normal View History

2025-01-17 10:49:57 +05:30
#!/bin/sh
echo "Enter the file extension"
read ext
echo "Enter the destination folder"
read dest
mkdir -p "$dest"
files=$(find . -maxdepth 1 -type f -name "*.$ext")
echo "$files"
for file in $files; do
cp "$file" "$dest"
done
echo "Successfully copied files to target directory"