폴더를 두 개로 나누는 터미널 명령이 있습니까? 없습니다. ls -a터미널에서 할 수 있고 모든 것을

Ubuntu 12.04.1을 실행하는 iMac G5에 80.000 개의 파일이있는 폴더가 있는데, 정지되어 노틸러스로 열 수도 없습니다.

ls -a터미널에서 할 수 있고 모든 것을 보여줍니다.

노틸러스가 두 파일 중 하나를 쉽게 열 수 있도록 동일한 크기의 파일 수로 분할하는 데 사용할 수있는 터미널 명령이 있습니까? 아니면 4 개의 폴더?



답변

ls -1 | sort -n | head -40000 | xargs -i mv "{}" /destination/folder/

head -40000필요에 맞게 조정 하십시오./destination/folder/


답변

Linuxquestions.org 에서 찾은 아래 스크립트를 사용해보십시오.

PhotosPath="/media/4GBSD/DCIM/101CANON"
SortPath="/home/angus/.imagesort"
LibraryPath="/home/angus/Photos"
CameraPath="/media/4GBSD"

필요에 따라이 경로의 이름을 바꾸십시오.

#!/bin/bash
#
#
PhotosPath="/media/4GBSD/DCIM/101CANON"
SortPath="/home/angus/.imagesort"
LibraryPath="/home/angus/Photos"
CameraPath="/media/4GBSD"
CharFromName=4
echo
echo
############
# Test to see if $PhotosPath exists, if not promp for new path / exit.
test -d $PhotosPath || read -p "$PhotosPath does not exist, close to exit or type new path:" PhotosPath
test -d $PhotosPath || "read -p '$PhotosPath is invalid. Press enter to close' && exit"

############
# move files from camera to $SortPath
mv $PhotosPath/* $SortPath/

############
# rename all image files in $SortPath
# FolderDateDD-HHMMSS.ext
jhead  -autorot -ft -nf%y%m%d-%H%M%S $SortPath/*

###########
# Sort files into folders using $CharFromName letters of the file name
#
ls $SortPath | while read file; do
 # extract first $CharFromName characters from filename
 FolderDate=${file:0:$CharFromName}
 # create directory if it does not exist
 test -d $LibraryPath/$FolderDate || mkdir $LibraryPath/$FolderDate
 # move the current file to the destination dir
 mv -v $SortPath/$file $LibraryPath/$FolderDate/$file
done

##########
# move sorted files into photo library
#mv -v $SortPath/* $LibraryPath/ 

##########
# Umount the card
umount $CameraPath

##########
# End notification
echo
echo "Photos  from: $PhotosPath"
echo "End location: $LibraryPath"
echo
echo "The card has been ejected."
echo
read -p "Press enter to close this window…"


답변