폴더를 두 개로 나누는 터미널 명령이 있습니까?


8

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

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

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


2
여전히 파워 아이맥 G5에 충돌 노틸러스가! ... 당신이 시도 할 수있는 것이다 80.000 파일, 4 개 폴더 분할을 열려면 mkdir folder1다음 cp *.txt folder1매를 복사 txtfolder1와 같은 확장에 그렇게 cp *.jpg folder2 cp *.doc folder3 cp *.docx folder3. 노틸러스는보다 쉽게 ​​볼 수 있어야합니다.
blade19899

모든 파일은 .jpg 형식으로되어 있습니다.

shotwell와 폴더를 선택하고 날짜 및 폴더를 생성 shotwell하자
blade19899

답변:


10

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

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


1

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…"

1
너무 복잡하지만 번거 로움에 감사드립니다. 다른 사람의 솔루션이 훨씬 쉽습니다. 사람들은 자신이 알고있는 삶을 살아야하며 터미널 앞에서 낭비하지 않아야합니다. 기술은 당신을 항상 도와주는 것이 아니라 당신을 도와

@Sergiu도 PC를 파괴하지 않습니다! 다른 해결책은 너무 간단하며 위험하다고 특징 짓는 것을 망설이지 않습니다. for 또는 while 루프는 여기서 완벽하게 수행됩니다.
hytromo
당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.