Questions tagged [basename]
51 questions
0
votes
0 answers
for loop concatenating files that share part of their common basename (paired end sequencing reads)
I'm trying to concatenate a bunch of paired files into one file (for those who work with sequencing data, you'll be familiar with the paired-end read format).
For example, I…

Samantha Goldman
- 3
- 2
0
votes
1 answer
Replacing specific strings in all matching files content with the file's basename using PowerShell
Get-ChildItem 'C:\Users\Zac\Downloads\script test\script test\*.txt' -Recurse | ForEach {(Get-Content $_ | ForEach { $_ -replace '1000', $fileNameOnly}) | Set-Content $_ }
I have been trying to use a simple PowerShell script to replace the 1000…
0
votes
0 answers
Basename: extra operand error when on linux command
I tried to create a loop to get all the filenames and fileID. Here are the…

minhntran
- 1
- 1
0
votes
1 answer
find -exec with subcommand
I am currently working on a script, that shall set the titles of all found MKV/MKA/MKS files to their basename for example:
/path/to/the/file/this is a cool title.mkv
Should be automatically edited with mkvpropedit and the title shall be set to…

Martin
- 208
- 4
- 15
0
votes
2 answers
Extracting basename from a a string with mixed slashes
I am trying to extract the basename abcd.txt from the following, which I am getting from a join operation performed on a list :
path = "my/python/is/working"
list = ["abcd","efgh","ijkl"]
path_of_each_file = [path + "\\" + x for x in…

DiffTrav
- 3
- 2
0
votes
2 answers
basename the contents of a file
I've got a file that contains a list of file paths. I'd like to apply basename to the contents of the file.
File contents look like…

Mike
- 921
- 7
- 26
0
votes
1 answer
(Shell) Create a recursive function which return the basename of files, preserving hirarchy
Currently, I have the following:
#!/bin/sh
pathlink() {
for file in "$@";
do
if [ -d "$file" ];
then
# echo "$file"
pathlink "$file/*"
else
echo '/home/buddhilw/dotfiles/'$(basename $file)
# ln -nfs…

BuddhiLW
- 608
- 3
- 9
0
votes
1 answer
How to convert images with negative number as a name to animation/video?
I create animation ( gif) or video from a sequence of static images. Images have real number as a name, for example -1.000.pgm
When numbers are positive ( without minus sign) then it works
#!/bin/bash
# script file for BASH
# which bash
#…

Adam
- 1,254
- 12
- 25
0
votes
1 answer
Using Sed to Parse Base Filename into Replacement Argument
Working within a directory of two thousand plus of text files, I need to replace a certain string in each of those text files from "template.cmp" into "actualfilename". For example, for a file like mdgen.cmp, I need the original string of…

waiwai57
- 35
- 4
0
votes
1 answer
Powershell - How to prefix filename into folder for any path containing that file type
Powershell script needed to pull the file basename from a file type within time and date stamped folders on a directory and append those folders with that base name.
The script below works to replace the path name below but I need to prefix the…

Eric Katzenmeyer
- 3
- 3
0
votes
2 answers
Why is basename in this shell script necessary?
I found this shell script($1,$2 are directories):
mv "$2" "$1" || exit # Make $2 a subdirectory of $1
cd "$1/$(basename "$2")" || exit # Change directories for simplicity
for f in *; do
mv "$f" "${f%.*}.txt" # Add…

newhere
- 31
- 5
0
votes
1 answer
Using basename and absolute path inside a for loop at the same time
Let's say I have
for i in `ls -1 /home/samples/*_1.fq.gz | sed 's/_1.fq.gz//'`
do
bbduk.sh -Xmx1g in1=$i\_1.fq.gz in2=$i\_2.fq.gz out1=/home/output/BASENAME\_clean_1.fq.gz out2=/home/output/BASENAME\_clean_2.fq.gz…

Gabriel G.
- 555
- 1
- 3
- 13
0
votes
1 answer
bash: how to list a leaf directory in the unknown path?
I have multiple directories that in turn contain subdirectories. Example:
company_a/raw/2020/12
The value of the first directory (company_a in the sample above) is variable, but always with a pattern "word_letter"
The value of the second directory…

kamokoba
- 497
- 9
- 17
0
votes
2 answers
PHP: basename not working as expected on special character
Here's my code:
$url = "https://de.wikipedia.org/wiki/…_und_wenn_der_letzte_Reifen_platzt";
$base = basename($url);
echo $base . "
"; $url2 = urlencode($base); echo $url2 . "
"; $url = dirname($url) . "/" . $url2; echo $url; $aHeader =…
"; $url2 = urlencode($base); echo $url2 . "
"; $url = dirname($url) . "/" . $url2; echo $url; $aHeader =…

Fuxi
- 7,611
- 25
- 93
- 139
0
votes
0 answers
Powershell - Need help putting grouping files into Hash Table based on partial matching names
I'm trying to put PDF files into a Hash Table Group based on the file names which use different naming conventions.
The first set of files follows the following format:
0343453 - SHORT NAME.pdf
0325423 - MEDIUM NAME.pdf
0323546 - A VERY LONG…

Makawide
- 13
- 5