directory

Unix Bash Remove Duplicate Lines From Directory Files?

僤鯓⒐⒋嵵緔 提交于 2019-12-12 04:16:12
问题 I have a directory with a few hundred txt files. I need to remove all duplicate lines from each of the existing files. Every line in the entire directory should be unique regardless of the file it's in, so I need to compare and check each file against the other. Is this possible to do without altering the existing file structure? The file names need to stay the same. Let's say all the files are in directory "foo" and the total size of the directory is 30mb. I think I can do this through comm

Many images in the same folder in a Linux based application

我的未来我决定 提交于 2019-12-12 04:05:08
问题 I have a Linux based application (Drupal - PHP + Apache + MySQL) that is quickly scaling to hold thousands of pictures in the same folder. I am probably close to 2,000 right now. Are there any drawbacks of having so many images in a single folder? Could it represent an impact in terms of performance? I am not planning to browse files in that folder and the server is simply serving the images when their URL is requested, but I wonder if I will have problems in the future (the application is

how to remove all subfolders except ones with foldername X using Terminal [closed]

天大地大妈咪最大 提交于 2019-12-12 03:53:23
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What is the best way to remove all subfolders except ones with folder name X and Y using Terminal. 回答1: find . -mindepth 1 -d -type d ! -name X -a ! -name Y -exec rm -r {} \+ mkdir d; touch d/f; find . -name d -delete doesn't seem to work. -mindepth 1 and -d are optional at least on OS X. Without -mindepth -1

htaccess rewrite all image requests from a non-existent folder to folder-name.jpg

徘徊边缘 提交于 2019-12-12 03:48:55
问题 Here's what I am trying to do, for example . . . http://www.website.com/images/folder-with-a-crazy-name/any-image-at-all.jpg would rewrite to . . . http://www.website.com/images/folder-with-a-crazy-name.jpg Does this make sense? Any help would be appreciated. 回答1: To rewrite all jpeg image files in a folder to that folder with .jpg appended RewriteRule ^images/(.+?)/[^/]+?\.jpg$ /images/$1.jpg [L] 回答2: Just paste this into your .htaccess file: Options +FollowSymlinks RewriteEngine on

Why won't my image show in HTML?

社会主义新天地 提交于 2019-12-12 03:35:55
问题 I'm having issues with getting an image to display on my HTML page. I currently have "image.png" in the same folder as the .html file and it still won't work. I am using Chrome btw. Here is my code: <!DOCTYPE html> <head> <title> Title </title> </head> <body> <h1> This is an image </h1> <img src = “image.png” alt = “Image text”/> </body> </html> 回答1: You seem to be using smart quotes . You need to use normal ones. Replace “ with '"' and ” with " <img src = "image.png" alt = "Image text"/> You

How to create new files in my external slot SDCARD ( its not in internal storage) - “/mnt/sdcard2/”

狂风中的少年 提交于 2019-12-12 03:31:32
问题 my question is I need to use files from my external slot sdcard, please dont suggest me to use Environment.getExternalStorageDirectory() - it is for internal storage I wanted to created files in external storage 回答1: I don't think its possible. When I was working on my own app I encountered the same problem if there is internal writable memory. Searched for days trying to find out how how to get the actual external SD card but no luck. I thinks its because the way android uses storage, the

JavaFX FileChooser initial directory

青春壹個敷衍的年華 提交于 2019-12-12 03:17:46
问题 In Swing, the JFileChooser pointed to the user's default directory which is typically the "My Documents" folder in Windows. The JavaFX FileChooser does not have the same behavior by default. There is a setInitialDirectory method which should be fine, however there are a number of places in the application that we open FileChoosers. Unfortunately the FileChooser class is final, so I cannot simply extend the class and just call the setInitialDirectory once. Is there anything else I could do

How to get complete path and name of each file in Download directory in Android

拜拜、爱过 提交于 2019-12-12 03:17:07
问题 I am going to develop an app, where user can choose File from a Download directory. Now i need the path + name of the file, which the user has chosen. DownloadManager dm = (DownlaodManager) getSystemService(DOWNLOAD_SERVICE); By this way the user can choose the file. Now i need the absoloute path of the file, which is choosen. But the problem here is, if the user chosse a file, the file will be open(this shouldn't be happen) Can anyone of you help me with that? 回答1: Use, Environment

How to copy one folder to all other subfolders of a folder?

天大地大妈咪最大 提交于 2019-12-12 03:07:37
问题 I want to copy folder IMAGE to all other folders in a folder. The folder structure is: Test folder FirstSubFolder IMAGE OneMoreSubFolder Test Folder 1 TestFolder2 The result should be: Test folder FirstSubFolder IMAGE IMAGE OneMoreSubFolder IMAGE Test Folder 1 IMAGE TestFolder2 IMAGE Which commands do I need in a batch script to do this folder copying task? 回答1: With Test folder being the current directory use following batch code: @echo off for /D %%D in (*) do ( if /I not "%%D" == "IMAGE" (

Group items based on x number characters of basename

喜夏-厌秋 提交于 2019-12-12 02:56:53
问题 I got help to setup a clever script that groups items in a folder based on basename and LastWriteTime it lets me delete everything except given number of files (i.e 5 versions). Now I'd like to limit basename grouping to 8 characters. gci C:\test\ | where{-not $_.PsIsContainer} | $file = basename Group-Object $file.substring(8) | foreach { $_.Group | sort LastWriteTime -Descending | Select -Skip 5 | foreach { Remove-Item $_.fullname -Force -WhatIf } } As I'm really new to powershell I'm not