bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find: print trailing slash for directories


From: Martin Schulte
Subject: Re: find: print trailing slash for directories
Date: Sun, 7 Aug 2022 18:50:05 +0200

Hi!

> Could somebody please advise, if there is some easy way to patch this
> myself?

DISCLAIMER:
- For the reasons mentioned here before I don't consider this a good idea but 
as long as you promise not to tell anyone that it was me you provided the patch 
;-)
- I tried it with Debian 11
- It has not been thoroughly tested 

In file find/pred.d in the body of the function pred_print replace

  print_quoted (pred_ptr->args.printf_vec.stream,
                pred_ptr->args.printf_vec.quote_opts,
                pred_ptr->args.printf_vec.dest_is_tty,
                "%s\n", pathname);

by

  if ( stat_buf->st_mode & S_IFDIR ) {
    print_quoted (pred_ptr->args.printf_vec.stream,
                  pred_ptr->args.printf_vec.quote_opts,
                  pred_ptr->args.printf_vec.dest_is_tty,
                  "%s/\n", pathname);
  } else {
    print_quoted (pred_ptr->args.printf_vec.stream,
                  pred_ptr->args.printf_vec.quote_opts,
                  pred_ptr->args.printf_vec.dest_is_tty,
                  "%s\n", pathname);
  }

Best regards,

Martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]