Linuxexit code > 0

File exists

$mkdir: cannot create directory 'folder': File exists

Analysis

You are trying to create a file or directory that already exists.

Common Triggers

  • Running a script multiple times without cleanup.
  • Race condition between checking existence and creating.

Debug Checks

  • $Check if the file exists: ls -d <path>.

Resolution

1
Remove the existing file first: rm <file>.
2
Use flags to ignore/overwrite: mkdir -p.