Tuesday, December 24, 2024

finder – Easy methods to take away a file which title appears to be “.” on an SMB share?

Overview

Incorrect specification of an argument in a commandline software (particulars under) has led to the creation of a file actually named “.”. I’ve already discovered that straight making an attempt to delete in Finder will set off deletion of all content material within the containing folder (thankfully it is a short-term folder), however nonetheless not the “.” file itself. Furthermore, no folders containing this file could be efficiently deleted, neither with Finder nor from bash/zsh shell.

How can one really delete (or rename) such a file?


Makes an attempt to delete from zsh

For instance:

mytmp % ls -hal
whole 65
drwx------  1 person  employees    16K Aug 21 11:20 .
-rwx------  1 person  employees     0B Aug 21 09:51 .
drwx------  1 person  employees    16K Aug 16 16:30 ..

mytmp % ls -aB
.   .   ..

mytmp % rm -rf '.'                   
rm: "." and ".." will not be eliminated

mytmp % cd ..

scratch % rm -rf mytmp
rm: mytmp: Permission denied

scratch % sudo rm -rf mytmp
rm: mytmp: Permission denied

I’ve additionally tried variations with out -r, since actually it’s the non-directory model that’s to be deleted.

I moreover tried the suggestion of @bmike to use the inode. Whereas we will establish the inode, the deletion doesn’t seem to work:

scratch % ls -ila mytmp
whole 65
8056451580272514705 drwx------  1 person  employees  16384 Aug 21 11:20 .
8652239633868421122 -rwx------  1 person  employees      0 Aug 21 09:51 .
                  2 drwx------  1 person  employees  16384 Aug 21 11:43 ..

scratch % discover mytmp -inum 8652239633868421122 -delete

## no change
scratch % ls -ila mytmp
whole 65
8056451580272514705 drwx------  1 person  employees  16384 Aug 21 11:20 .
8652239633868421122 -rwx------  1 person  employees      0 Aug 21 09:51 .
                  2 drwx------  1 person  employees  16384 Aug 21 11:43 ..

Is it actually named “.”?

@nohillside proposed to delimit the listings with x and y to see if it actually is known as “.”. From bash:

bash-3.2$ for i in .*; do echo x${i}y; performed
x.y
x.y
x..y

Seems so.

@fd0 instructed printing non-printing characters with cat -vet. From bash:

bash-3.2$ ls -1a | cat -vet
.$
.$
..$

Once more, appears identically named.

@nohillside Urged operating a Python server from the listing and show its listing itemizing:

Directory listing from Python server is empty


Extra Background

The folder is on a community Quantity, format SMB (OS X).

The software that resulted on this was haplogrep, a Java-based CLI. One can set up it by way of Conda by way of

conda set up -c conda-forge -c bioconda haplogrep

The subcommand used was haplogrep classify, which has the next choices:

mytmp % haplogrep classify

mtDNA Haplogroup Classifiction v2.4.0
https://github.com/seppinho/haplogrep-cmd
(c) Sebastian Schönherr, Hansi Weissensteiner, Lukas Forer, Dominic Pacher
[email protected]

[classify]
Lacking required choices: '--input=<in>', '--output=<out>', '--format=<format>'
Utilization: haplogrep classify [--chip] [--extend-report] [--rsrs]
                          [--skip-alignment-rules] [--write-fasta]
                          [--write-fasta-msa] --format=<format>
                          [--hetLevel=<hetLevel>] [--hits=<hits>] --in=<in>
                          [--lineage=<lineage>] [--metric=<metric>] --out=<out>
                          [--phylotree=<tree>]
      --chip                VCF knowledge from a genotype chip
                              Default: false
      --extend-report       Add flag for a prolonged ultimate output
                              Default: false
      --format=<format>     Specify enter file format: vcf, fasta or hsd
      --hetLevel=<hetLevel> Add heteroplasmies with a degree > X from the VCF
                              file to the profile (default: 0.9)
      --hits=<hits>         Calculate greatest n hits
      --in, --input=<in>    Enter VCF, fasta or hsd file
      --lineage=<lineage>   Export lineage data as dot file, n0=no
                              tree, 1=with SNPs, 2=solely construction, no SNPs
      --metric=<metric>     Specifiy different metrics (hamming or jaccard) than
                              default (kulczynski)
      --out, --output=<out> Output file location
      --phylotree=<tree>    Specify phylotree model
      --rsrs                Use RSRS Model
                              Default: false
      --skip-alignment-rules
                            Skip mtDNA nomenclature fixes based mostly on guidelines for
                              FASTA import
                              Default: false
      --write-fasta         Write ends in fasta format
                              Default: false
      --write-fasta-msa     Write a number of sequence alignment (_MSA.fasta)
                              Default: false

I misinterpreted the “Output file location” description of the --out argument as asking for a path, main me to make use of --out . and thus leading to making a file named “.”.

Renaming

The file itself can’t be renamed in Finder or with mv, nonetheless, the containing folder could be renamed.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles